Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Last changes with Kent.

Added fixed bugs to Release notes.
Updated version number.
Updated README.html

Signed-off-by: Kent Beck <kent@threeriversinstitute.org>
  • Loading branch information...
commit 70986438ca98df55899e293a72931fc12bb737d9 1 parent 06d5155
David Saff authored KentBeck committed
View
2  README
@@ -1 +1 @@
-test
+Please read README.html
View
114 README.html
@@ -18,7 +18,7 @@
<br>(see also <a href="http://www.junit.org">JUnit.org</a>)
<hr WIDTH="100%">
-<br>[old date] 8 August 2008
+<br>6 April 2009
<p>JUnit is a simple framework to write repeatable tests. It is an instance
of the xUnit architecture for unit testing frameworks.
<ul>
@@ -43,6 +43,113 @@
<a NAME="Summary of">
<h2>Summary of Changes in version 4.6</h2>
+<h3>Max</h3>
+
+<p>JUnit now includes a new experimental Core, <code>MaxCore</code>. <code>MaxCore</code>
+remembers the results of previous test runs in order to run new
+tests out of order. <code>MaxCore</code> prefers new tests to old tests, fast
+tests to slow tests, and recently failing tests to tests that last
+failed long ago. There's currently not a standard UI for running
+<code>MaxCore</code> included in JUnit, but there is a UI included in the JUnit
+Max Eclipse plug-in at:</p>
+
+<p>http://www.junitmax.com/junitmax/subscribe.html</p>
+
+<p>Example:</p>
+
+<pre><code>public static class TwoUnEqualTests {
+ @Test
+ public void slow() throws InterruptedException {
+ Thread.sleep(100);
+ fail();
+ }
+
+ @Test
+ public void fast() {
+ fail();
+ }
+}
+
+@Test
+public void rememberOldRuns() {
+ File maxFile = new File("history.max");
+ MaxCore firstMax = MaxCore.storedLocally(maxFile);
+ firstMax.run(TwoUnEqualTests.class);
+
+ MaxCore useHistory= MaxCore.storedLocally(maxFile);
+ List&lt;Failure&gt; failures= useHistory.run(TwoUnEqualTests.class)
+ .getFailures();
+ assertEquals("fast", failures.get(0).getDescription().getMethodName());
+ assertEquals("slow", failures.get(1).getDescription().getMethodName());
+}
+</code></pre>
+
+<h3>Test scheduling strategies</h3>
+
+<p><code>JUnitCore</code> now includes an experimental method that allows you to
+specify a model of the <code>Computer</code> that runs your tests. Currently,
+the only built-in Computers are the default, serial runner, and two
+runners provided in the <code>ParallelRunner</code> class:
+<code>ParallelRunner.classes()</code>, which runs classes in parallel, and
+<code>ParallelRunner.methods()</code>, which runs classes and methods in parallel.</p>
+
+<p>This feature is currently less stable than MaxCore, and may be
+merged with MaxCore in some way in the future.</p>
+
+<p>Example:</p>
+
+<pre><code>public static class Example {
+ @Test public void one() throws InterruptedException {
+ Thread.sleep(1000);
+ }
+ @Test public void two() throws InterruptedException {
+ Thread.sleep(1000);
+ }
+}
+
+@Test public void testsRunInParallel() {
+ long start= System.currentTimeMillis();
+ Result result= JUnitCore.runClasses(ParallelComputer.methods(),
+ Example.class);
+ assertTrue(result.wasSuccessful());
+ long end= System.currentTimeMillis();
+ assertThat(end - start, betweenInclusive(1000, 1500));
+}
+</code></pre>
+
+<h3>Comparing double arrays</h3>
+
+<p>Arrays of doubles can be compared, using a delta allowance for equality:</p>
+
+<pre><code>@Test
+public void doubleArraysAreEqual() {
+ assertArrayEquals(new double[] {1.0, 2.0}, new double[] {1.0, 2.0}, 0.01);
+}
+</code></pre>
+
+<h3><code>Filter.matchDescription</code> API</h3>
+
+<p>Since 4.0, it has been possible to run a single method using the <code>Request.method</code>
+API. In 4.6, the filter that implements this is exposed as <code>Filter.matchDescription</code>.</p>
+
+<h3>Documentation</h3>
+
+<ul>
+<li><p>A couple classes and packages that once had empty javadoc have been
+doc'ed.</p></li>
+<li><p>Added how to run JUnit from the command line to the cookbook.</p></li>
+<li><p>junit-4.x.zip now contains build.xml</p></li>
+</ul>
+
+<h3>Bug fixes</h3>
+
+<ul>
+<li>Fixed overly permissive @DataPoint processing (2191102)</li>
+<li>Fixed bug in test counting after an ignored method (2106324)</li>
+</ul>
+
+<h2>Summary of Changes in version 4.5</h2>
+
<h3>Installation</h3>
<ul>
@@ -556,11 +663,6 @@
<br><a href="doc/cookstour/cookstour.htm">JUnit - A cooks tour</a>
</blockquote>
-<h2><a NAME="Known Defects"></a>Known Defects</h2>
-<ul>
-<li>Multi-dimensional arrays are not processed correctly by assertEquals.</li>
-</ul>
-
<hr WIDTH="100%">
<!--webbot bot="HTMLMarkup" startspan --><a href="http://sourceforge.net"><IMG
src="http://sourceforge.net/sflogo.php?group_id=15278"
View
7 doc/ReleaseNotes4.6.html
@@ -97,3 +97,10 @@
<li><p>Added how to run JUnit from the command line to the cookbook.</p></li>
<li><p>junit-4.x.zip now contains build.xml</p></li>
</ul>
+
+<h3>Bug fixes</h3>
+
+<ul>
+<li>Fixed overly permissive @DataPoint processing (2191102)</li>
+<li>Fixed bug in test counting after an ignored method (2106324)</li>
+</ul>
View
30 doc/ReleaseNotes4.6.txt
@@ -2,19 +2,19 @@
### Max ###
-- JUnit now includes a new experimental Core, `MaxCore`. `MaxCore`
- remembers the results of previous test runs in order to run new
- tests out of order. `MaxCore` prefers new tests to old tests, fast
- tests to slow tests, and recently failing tests to tests that last
- failed long ago. There's currently not a standard UI for running
- `MaxCore` included in JUnit, but there is a UI included in the JUnit
- Max Eclipse plug-in at:
-
- http://www.junitmax.com/junitmax/subscribe.html
-
- Example:
-
- public static class TwoUnEqualTests {
+JUnit now includes a new experimental Core, `MaxCore`. `MaxCore`
+remembers the results of previous test runs in order to run new
+tests out of order. `MaxCore` prefers new tests to old tests, fast
+tests to slow tests, and recently failing tests to tests that last
+failed long ago. There's currently not a standard UI for running
+`MaxCore` included in JUnit, but there is a UI included in the JUnit
+Max Eclipse plug-in at:
+
+ http://www.junitmax.com/junitmax/subscribe.html
+
+Example:
+
+ public static class TwoUnEqualTests {
@Test
public void slow() throws InterruptedException {
Thread.sleep(100);
@@ -94,3 +94,7 @@ API. In 4.6, the filter that implements this is exposed as `Filter.matchDescrip
- Added how to run JUnit from the command line to the cookbook.
- junit-4.x.zip now contains build.xml
+
+### Bug fixes ###
+- Fixed overly permissive @DataPoint processing (2191102)
+- Fixed bug in test counting after an ignored method (2106324)
View
2  doc/markdown.sh
@@ -1 +1 @@
-~/bin/Markdown.pl ReleaseNotes4.4.txt >ReleaseNotes4.4.html
+~/bin/Markdown.pl ReleaseNotes4.6.txt >ReleaseNotes4.6.html
View
2  src/main/java/junit/runner/Version.java
@@ -9,7 +9,7 @@ private Version() {
}
public static String id() {
- return "4.5";
+ return "4.6-RC1";
}
public static void main(String[] args) {
View
31 src/main/java/org/junit/Assert.java
@@ -365,6 +365,37 @@ public static void assertArrayEquals(double[] expecteds, double[] actuals, doubl
}
/**
+ * Asserts that two double arrays are equal. If they are not, an
+ * {@link AssertionError} is thrown with the given message.
+ *
+ * @param message
+ * the identifying message for the {@link AssertionError} (<code>null</code>
+ * okay)
+ * @param expecteds
+ * double array with expected values.
+ * @param actuals
+ * double array with actual values
+ */
+ public static void assertArrayEquals(String message, float[] expecteds,
+ float[] actuals, float delta) throws ArrayComparisonFailure {
+ new InexactComparisonCriteria(delta).internalArrayEquals(message, expecteds, actuals);
+ }
+
+ // TODO (Mar 10, 2009 10:52:18 AM): fix javadoc
+ /**
+ * Asserts that two double arrays are equal. If they are not, an
+ * {@link AssertionError} is thrown.
+ *
+ * @param expecteds
+ * double array with expected values.
+ * @param actuals
+ * double array with actual values
+ */
+ public static void assertArrayEquals(float[] expecteds, float[] actuals, float delta) {
+ assertArrayEquals(null, expecteds, actuals, delta);
+ }
+
+ /**
* Asserts that two object arrays are equal. If they are not, an
* {@link AssertionError} is thrown with the given message. If
* <code>expecteds</code> and <code>actuals</code> are <code>null</code>,
View
4 src/main/java/org/junit/experimental/max/MaxCore.java
@@ -18,6 +18,10 @@
import org.junit.runners.model.InitializationError;
public class MaxCore {
+ public static MaxCore forFolder(String fileName) {
+ return storedLocally(new File(fileName));
+ }
+
public static MaxCore storedLocally(File storedResults) {
return new MaxCore(storedResults);
}
View
5 src/main/java/org/junit/internal/InexactComparisonCriteria.java
@@ -59,7 +59,10 @@ public void internalArrayEquals(String message, Object expecteds,
}
} else
try {
- Assert.assertEquals((Double)expected, (Double)actual, fDelta);
+ if (expected instanceof Double)
+ Assert.assertEquals((Double)expected, (Double)actual, fDelta);
+ else
+ Assert.assertEquals((Float)expected, (Float)actual, fDelta);
} catch (AssertionError e) {
throw new ArrayComparisonFailure(header, e, i);
}
View
9 src/test/java/org/junit/tests/assertion/AssertionTest.java
@@ -121,17 +121,22 @@ public void oneDimensionalPrimitiveArraysAreEqual() {
assertArrayEquals(new short[] {1}, new short[] {1});
assertArrayEquals(new int[] {1}, new int[] {1});
assertArrayEquals(new long[] {1}, new long[] {1});
- // TODO: add floats
assertArrayEquals(new double[] {1.0}, new double[] {1.0}, 1.0);
+ // TODO (Mar 10, 2009 10:47:34 AM): Import
+ Assert.assertArrayEquals(new float[] {1.0f}, new float[] {1.0f}, 1.0f);
}
@Test(expected=AssertionError.class)
public void oneDimensionalDoubleArraysAreNotEqual() {
- // TODO: add floats
assertArrayEquals(new double[] {1.0}, new double[] {2.5}, 1.0);
}
@Test(expected=AssertionError.class)
+ public void oneDimensionalFloatArraysAreNotEqual() {
+ assertArrayEquals(new float[] {1.0f}, new float[] {2.5f}, 1.0f);
+ }
+
+ @Test(expected=AssertionError.class)
public void IntegerDoesNotEqualLong() {
assertEquals(new Integer(1), new Long(1));
}
Please sign in to comment.
Something went wrong with that request. Please try again.