Skip to content

Commit

Permalink
changes for 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
egamma committed May 21, 2001
1 parent 04f4f31 commit 538187a
Show file tree
Hide file tree
Showing 26 changed files with 246 additions and 234 deletions.
72 changes: 67 additions & 5 deletions README.html
Expand Up @@ -3,19 +3,19 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
<meta name="Author" content="Erich Gamma">
<title>JUnit 3.6</title>
<meta name="Author" content="Erich Gamma & Kent Beck">
<title>JUnit 3.7</title>
</head>
<body>

<h1>
<b><font color="#00CC00">J</font><font color="#FF0000">U</font><font color="#000000">nit
3.6
3.7
</font><font color="#808080">@</font><font color="#000000">&nbsp;</font></b><!--webbot bot="HTMLMarkup" startspan --><a href="http://sourceforge.net"><img SRC="sflogo.php" ALT="SourceForge Logo" BORDER=0 height=31 width=88></a><!--webbot
bot="HTMLMarkup" endspan --></h1>

<hr WIDTH="100%">
<br>03/27/2001
<br>05/18/2001
<p>JUnit is a simple framework to write repeatable tests. It is an instance
of the xUnit architecture for unit testing frameworks.
<ul>
Expand All @@ -36,7 +36,69 @@ <h1>
</ul>

<h2>
<a NAME="Summary of"></a>Summary of Changes between 3.5 and 3.6</h2>
<a NAME="Summary of"></a>Summary of Changes between 3.6 and 3.7</h2>

<h3>
GUI</h3>

<ul>
<li>
Eliminated warning when re-running tests when class loading checkbox is
unchecked. There are legitimate reasons for doing this, so a warning didn't
make much sense, and it was too obtrusive.</li>

<li>
Stopped reloading classes when running in VisualAge for Java.</li>

<li>
Print total number of tests as well as number of tests run so far (Swing
only).</li>
</ul>

<h3>
Framework</h3>

<ul>
<li>
Introduced Assert.assertTrue(boolean) and assertTrue(String, boolean) deprecated
assert(boolean) and assert(String, boolean) in preparation for the assert
keyword in Java 1.4. We plan to support native assertions when they are
publicly available. You can either move to assertTrue() or wait for 1.4
and delete parentheses as the syntax is e.g. "assert 2 == 3".</li>

<li>
Added accessors for TestCase.fName and TestSuite.fName.</li>

<li>
Added a no argument TestCase constructor to support serialization.</li>

<li>
Improved warnings when constructing TestSuites.</li>
</ul>

<h3>
Text Runner</h3>

<ul>
<li>
Made doRun() public so clients can create a text runner with a specified
output stream and then run tests.</li>
</ul>

<h3>
Fixed Bugs (SourceForge Bug Tracker Ids)</h3>
&nbsp;&nbsp;&nbsp; [420315] No trace when fail with message...
<br>&nbsp;&nbsp;&nbsp; [419375] reload warning lags
<br>&nbsp;&nbsp;&nbsp; [418849] Classloader warning too obtrusive
<br>&nbsp;&nbsp;&nbsp; [417978] constructor stack trace, please
<br>&nbsp;&nbsp;&nbsp; [415103] Reload checkbox should be ignored in VAJ
<br>&nbsp;&nbsp;&nbsp; [414954] error reporting when invoking suite()
<br>&nbsp;&nbsp;&nbsp; [407296] Make doRun() public
<br>&nbsp;&nbsp;&nbsp; [227578] rmi callbacks fail since TestCase has no
noArg constructor
<br>&nbsp;&nbsp;&nbsp; [422603] Decorated decorators bug
<h2>
Summary of Changes between 3.5 and 3.6</h2>

<h3>
TestRunner</h3>
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -2,7 +2,7 @@
<project name="junit" default="dist" basedir=".">
<target name="init">
<tstamp/>
<property name="version" value="3.6" />
<property name="version" value="3.7" />
<property name="dist" value="junit${version}" />
<property name="versionfile" value="junit/runner/Version.java" />
<property name="zipfile" value="${dist}.zip" />
Expand Down
8 changes: 0 additions & 8 deletions doc/cookbook/cookbook.htm
Expand Up @@ -160,14 +160,6 @@ <h2>
</font></tt>suite.addTest(Kent.suite());
suite.addTest(Erich.suite());
TestResult result= suite.run();</pre>
TestSuites don't only have to contain TestCases. They contain any object
that implements the Test interface. For example, you can create a TestSuite
in your code and I can create one in mine, and we can run them together
by creating a TestSuite that contains both:
<pre><tt><font face="Courier">TestSuite suite= new TestSuite();
</font></tt>suite.addTest(Kent.suite());
suite.addTest(Erich.suite());
TestResult result= suite.run();</pre>

<h2>
TestRunner</h2>
Expand Down
2 changes: 1 addition & 1 deletion doc/faq/faq.htm
Expand Up @@ -158,7 +158,7 @@ <h2>
for each test run. The idea is that you typically have a working set of
classes that you work with and that there is a set of classes that you
don't change. The list of package prefixes is defined in the properties
file <tt>junit.util.excluded.properties</tt>. As we deliver it, this file
file <tt>junit/runner/excluded.properties</tt>. As we deliver it, this file
excludes the packages that come with jdk1.2 from reloading:
<blockquote><tt>#</tt>
<br><tt># The list of excluded package paths for the TestCaseClassLoader</tt>
Expand Down
26 changes: 8 additions & 18 deletions junit/awtui/TestRunner.java
Expand Up @@ -39,7 +39,6 @@ public class TestRunner extends BaseTestRunner {
protected Button fRerunButton;
protected TextField fStatusLine;
protected Checkbox fUseLoadingRunner;
protected int fNonLoadingRuns= 0;

protected static Font PLAIN_FONT= new Font("dialog", Font.PLAIN, 12);
private static final int GAP= 4;
Expand Down Expand Up @@ -185,7 +184,9 @@ public void actionPerformed(ActionEvent e) {
);
boolean useLoader= useReloadingTestSuiteLoader();
fUseLoadingRunner= new Checkbox("Reload classes every run", useLoader);

if (inVAJava())
fUseLoadingRunner.setVisible(false);

//---- second section
fProgressIndicator= new ProgressBar();

Expand Down Expand Up @@ -334,7 +335,7 @@ public void rerun() {
Class reloadedTestClass= getLoader().reload(test.getClass());
Class[] classArgs= { String.class };
Constructor constructor= reloadedTestClass.getConstructor(classArgs);
Object[] args= new Object[]{((TestCase)test).name()};
Object[] args= new Object[]{((TestCase)test).getName()};
reloadedTest=(Test)constructor.newInstance(args);
} catch(Exception e) {
showInfo("Could not reload "+ test.toString());
Expand Down Expand Up @@ -382,8 +383,7 @@ synchronized public void runSuite() {
if (fRunner != null) {
fTestResult.stop();
} else {
if (!setUseLoadingRunner())
return;
setLoading(shouldReload());
fRun.setLabel("Stop");
showInfo("Initializing...");
reset();
Expand Down Expand Up @@ -420,20 +420,10 @@ public void run() {
}
}

private boolean setUseLoadingRunner() {
setLoading(fUseLoadingRunner.getState());
if (!fUseLoadingRunner.getState())
fNonLoadingRuns++;
if (fNonLoadingRuns > 1) {
String message1= "Code modifications you made since the last run will be ignored.";
String message2= "It is recommended to restart the TestRunner. Do you still want to continue?";
WarningDialog dialog= new WarningDialog(fFrame, message1, message2);
dialog.show();
return dialog.getChoice();
}
return true;
private boolean shouldReload() {
return !inVAJava() && fUseLoadingRunner.getState();
}

private void setLabelValue(Label label, int value) {
label.setText(Integer.toString(value));
label.invalidate();
Expand Down
80 changes: 0 additions & 80 deletions junit/awtui/WarningDialog.java

This file was deleted.

23 changes: 21 additions & 2 deletions junit/framework/Assert.java
Expand Up @@ -13,6 +13,7 @@ protected Assert() {
/**
* Asserts that a condition is true. If it isn't it throws
* an AssertionFailedError with the given message.
* @deprecated use assertTrue
*/
static public void assert(String message, boolean condition) {
if (!condition)
Expand All @@ -21,10 +22,28 @@ static public void assert(String message, boolean condition) {
/**
* Asserts that a condition is true. If it isn't it throws
* an AssertionFailedError.
* @deprecated use assertTrue
*
*/
static public void assert(boolean condition) {
assert(null, condition);
}

/**
* Asserts that a condition is true. If it isn't it throws
* an AssertionFailedError with the given message.
*/
static public void assertTrue(String message, boolean condition) {
if (!condition)
fail(message);
}
/**
* Asserts that a condition is true. If it isn't it throws
* an AssertionFailedError.
*/
static public void assertTrue(boolean condition) {
assertTrue(null, condition);
}
/**
* Fails a test with the given message.
*/
Expand Down Expand Up @@ -177,7 +196,7 @@ static public void assertNotNull(Object object) {
* Asserts that an object isn't null.
*/
static public void assertNotNull(String message, Object object) {
assert(message, object != null);
assertTrue(message, object != null);
}
/**
* Asserts that an object is null.
Expand All @@ -189,7 +208,7 @@ static public void assertNull(Object object) {
* Asserts that an object is null.
*/
static public void assertNull(String message, Object object) {
assert(message, object == null);
assertTrue(message, object == null);
}
/**
* Asserts that two objects refer to the same object. If they are not
Expand Down
28 changes: 27 additions & 1 deletion junit/framework/TestCase.java
Expand Up @@ -75,7 +75,16 @@ public abstract class TestCase extends Assert implements Test {
/**
* the name of the test case
*/
private final String fName;
private String fName;

/**
* No-arg constructor to enable serialization. This method
* is not intended to be used by mere mortals.
*/
TestCase() {
fName= null;
}

/**
* Constructs a test case with the given name.
*/
Expand All @@ -99,6 +108,7 @@ protected TestResult createResult() {
}
/**
* Gets the name of the test case.
* @deprecated use getName()
*/
public String name() {
return fName;
Expand Down Expand Up @@ -182,4 +192,20 @@ protected void tearDown() throws Exception {
public String toString() {
return name()+"("+getClass().getName()+")";
}
/**
* Gets the name of a TestCase
* @return returns a String
*/
public String getName() {
return fName;
}

/**
* Sets the name of a TestCase
* @param name The name to set
*/
public void setName(String name) {
fName= name;
}

}

0 comments on commit 538187a

Please sign in to comment.