Skip to content

Commit

Permalink
Finished release notes, I think
Browse files Browse the repository at this point in the history
Signed-off-by: Kent Beck <kent@threeriversinstitute.org>
  • Loading branch information
David Saff authored and KentBeck committed Mar 12, 2009
1 parent 95da392 commit 8e20f52
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 29 deletions.
41 changes: 25 additions & 16 deletions doc/ReleaseNotes4.6.txt
Expand Up @@ -28,21 +28,16 @@
}

@Test
public void rememberOldRuns() throws CouldNotReadCoreException {
fMax.run(TwoUnEqualTests.class);
String storedResults= fMax.getFolder();

MaxCore reincarnation= MaxCore.forFolder(storedResults);
try {
List<Failure> failures= reincarnation.run(TwoUnEqualTests.class)
.getFailures();
assertEquals("fast", failures.get(0).getDescription()
.getMethodName());
assertEquals("slow", failures.get(1).getDescription()
.getMethodName());
} finally {
reincarnation.forget();
}
public void rememberOldRuns() {
File maxFile = new File("history.max");
MaxCore firstMax = MaxCore.storedLocally(maxFile);
firstMax.run(TwoUnEqualTests.class);

MaxCore useHistory= MaxCore.storedLocally(maxFile);
List<Failure> failures= useHistory.run(TwoUnEqualTests.class)
.getFailures();
assertEquals("fast", failures.get(0).getDescription().getMethodName());
assertEquals("slow", failures.get(1).getDescription().getMethodName());
}

### Test scheduling strategies ###
Expand All @@ -55,7 +50,7 @@ runners provided in the `ParallelRunner` class:
`ParallelRunner.methods()`, which runs classes and methods in parallel.

This feature is currently less stable than MaxCore, and may be
reimplemented in terms of MaxCore in the future.
merged with MaxCore in some way in the future.

Example:

Expand All @@ -77,6 +72,20 @@ Example:
assertThat(end - start, betweenInclusive(1000, 1500));
}

### Comparing double arrays ###

Arrays of doubles can be compared, using a delta allowance for equality:

@Test
public void doubleArraysAreEqual() {
assertArrayEquals(new double[] {1.0, 2.0}, new double[] {1.0, 2.0}, 0.01);
}

### `Filter.matchDescription` API ###

Since 4.0, it has been possible to run a single method using the `Request.method`
API. In 4.6, the filter that implements this is exposed as `Filter.matchDescription`.

### Documentation ###

- A couple classes and packages that once had empty javadoc have been
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/org/junit/experimental/max/MaxCore.java
Expand Up @@ -18,11 +18,7 @@
import org.junit.runners.model.InitializationError;

public class MaxCore {
public static MaxCore forFolder(String storedResults) {
return new MaxCore(new File(storedResults + ".ser"));
}

public static MaxCore forFolder(File storedResults) {
public static MaxCore storedLocally(File storedResults) {
return new MaxCore(storedResults);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/junit/runner/Request.java
Expand Up @@ -130,7 +130,7 @@ public Request filterWith(Filter filter) {
* @return the filtered Request
*/
public Request filterWith(final Description desiredDescription) {
return filterWith(Filter.matchDescription(desiredDescription));
return filterWith(Filter.matchMethodDescription(desiredDescription));
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/org/junit/runner/manipulation/Filter.java
Expand Up @@ -27,8 +27,12 @@ public String describe() {
return "all tests";
}
};
//TODO javadoc
public static Filter matchDescription(final Description desiredDescription) {

/**
* Returns a {@code Filter} that only runs the single method described by
* {@code desiredDescription}
*/
public static Filter matchMethodDescription(final Description desiredDescription) {
return new Filter() {
@Override
public boolean shouldRun(Description description) {
Expand Down
Expand Up @@ -22,7 +22,7 @@ public void createMax() {
fMaxFile= new File("MaxCore.ser");
if (fMaxFile.exists())
fMaxFile.delete();
fMax= new MaxCore(fMaxFile);
fMax= MaxCore.storedLocally(fMaxFile);
}

@After
Expand Down
Expand Up @@ -38,7 +38,7 @@ public void createMax() {
fMaxFile= new File("MaxCore.ser");
if (fMaxFile.exists())
fMaxFile.delete();
fMax= new MaxCore(fMaxFile);
fMax= MaxCore.storedLocally(fMaxFile);
}

@After
Expand Down Expand Up @@ -137,10 +137,9 @@ public void fast() {

@Test
public void rememberOldRuns() {
// TODO (Mar 9, 2009 10:40:03 PM): Direct access to fHistory
fMax.run(TwoUnEqualTests.class);

MaxCore reincarnation= MaxCore.forFolder(fMaxFile);
MaxCore reincarnation= MaxCore.storedLocally(fMaxFile);
List<Failure> failures= reincarnation.run(TwoUnEqualTests.class)
.getFailures();
assertEquals("fast", failures.get(0).getDescription().getMethodName());
Expand Down Expand Up @@ -198,7 +197,7 @@ public void junit3TestsAreRunOnce() throws Exception {
public void saffSqueezeExample() throws Exception {
final Description method= Description.createTestDescription(
TwoOldTests.class, "testOne");
Filter filter= Filter.matchDescription(method);
Filter filter= Filter.matchMethodDescription(method);
JUnit38ClassRunner child= new JUnit38ClassRunner(TwoOldTests.class);
child.filter(filter);
assertEquals(1, child.testCount());
Expand Down

0 comments on commit 8e20f52

Please sign in to comment.