diff --git a/pom.xml b/pom.xml
index e2548b52f480..f1c4f5090331 100644
--- a/pom.xml
+++ b/pom.xml
@@ -146,7 +146,7 @@
the project, requires only release versions of dependencies of other artifacts.
-->
maven-enforcer-plugin
- 1.3.1
+ 1.4
enforce-versions
@@ -211,7 +211,7 @@
java compiler plugin forked in extra process
-->
maven-compiler-plugin
- 3.2
+ 3.3
${project.build.sourceEncoding}
@@ -232,7 +232,7 @@
org.codehaus.mojo
animal-sniffer-maven-plugin
- 1.13
+ 1.14
signature-check
@@ -256,7 +256,7 @@
our junit suite "AllTests" after the sources are compiled.
-->
maven-surefire-plugin
- 2.18
+ 2.18.1
org/junit/tests/AllTests.java
true
@@ -278,7 +278,7 @@
in jar archive target/junit-*-javadoc.jar.
-->
maven-javadoc-plugin
- 2.10.1
+ 2.10.3
${basedir}/src/main/javadoc/stylesheet.css
protected
@@ -311,7 +311,7 @@
maven-release-plugin
- 2.5.1
+ 2.5.2
forked-path
false
@@ -337,7 +337,7 @@
maven-jar-plugin
- 2.5
+ 2.6
false
@@ -354,7 +354,7 @@
maven-project-info-reports-plugin
- 2.7
+ 2.8
false
@@ -381,7 +381,7 @@
maven-javadoc-plugin
- 2.10.1
+ 2.10.3
javadoc/latest
${basedir}/src/main/javadoc/stylesheet.css
@@ -440,7 +440,7 @@
(–– stands for double dash)
-->
maven-gpg-plugin
- 1.5
+ 1.6
gpg-sign
@@ -540,7 +540,7 @@
org.apache.maven.surefire
surefire-junit47
- 2.18
+ 2.18.1
diff --git a/src/main/java/org/junit/ComparisonFailure.java b/src/main/java/org/junit/ComparisonFailure.java
index 9563e61c5c7a..f7d2c3f9fc84 100644
--- a/src/main/java/org/junit/ComparisonFailure.java
+++ b/src/main/java/org/junit/ComparisonFailure.java
@@ -16,15 +16,10 @@ public class ComparisonFailure extends AssertionError {
* @see ComparisonCompactor
*/
private static final int MAX_CONTEXT_LENGTH = 20;
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private String fExpected;
- private String fActual;
+ private String expected;
+ private String actual;
/**
* Constructs a comparison failure.
@@ -35,8 +30,8 @@ public class ComparisonFailure extends AssertionError {
*/
public ComparisonFailure(String message, String expected, String actual) {
super(message);
- this.fExpected = expected;
- this.fActual = actual;
+ this.expected = expected;
+ this.actual = actual;
}
/**
@@ -46,7 +41,7 @@ public ComparisonFailure(String message, String expected, String actual) {
*/
@Override
public String getMessage() {
- return new ComparisonCompactor(MAX_CONTEXT_LENGTH, fExpected, fActual).compact(super.getMessage());
+ return new ComparisonCompactor(MAX_CONTEXT_LENGTH, expected, actual).compact(super.getMessage());
}
/**
@@ -55,7 +50,7 @@ public String getMessage() {
* @return the actual string value
*/
public String getActual() {
- return fActual;
+ return actual;
}
/**
@@ -64,7 +59,7 @@ public String getActual() {
* @return the expected string value
*/
public String getExpected() {
- return fExpected;
+ return expected;
}
private static class ComparisonCompactor {
diff --git a/src/main/java/org/junit/experimental/max/MaxHistory.java b/src/main/java/org/junit/experimental/max/MaxHistory.java
index 45a40336b3f6..f821fee07ab8 100644
--- a/src/main/java/org/junit/experimental/max/MaxHistory.java
+++ b/src/main/java/org/junit/experimental/max/MaxHistory.java
@@ -24,7 +24,7 @@
*
*/
public class MaxHistory implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
/**
* Loads a {@link MaxHistory} from {@code file}, or generates a new one that
@@ -45,60 +45,62 @@ public static MaxHistory forFolder(File file) {
private static MaxHistory readHistory(File storedResults)
throws CouldNotReadCoreException {
try {
- FileInputStream file = new FileInputStream(storedResults);
- try {
- ObjectInputStream stream = new ObjectInputStream(file);
- try {
- return (MaxHistory) stream.readObject();
- } finally {
- stream.close();
- }
- } finally {
- file.close();
- }
+ return tryRead(storedResults);
} catch (Exception e) {
throw new CouldNotReadCoreException(e);
}
}
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private final Map fDurations = new HashMap();
- private final Map fFailureTimestamps = new HashMap();
- private final File fHistoryStore;
+ private static MaxHistory tryRead(File storedResults) throws IOException, ClassNotFoundException {
+ FileInputStream file = new FileInputStream(storedResults);
+ try {
+ return readObject(file);
+ } finally {
+ file.close();
+ }
+ }
+
+ private static MaxHistory readObject(FileInputStream file) throws IOException, ClassNotFoundException {
+ ObjectInputStream stream = new ObjectInputStream(file);
+ try {
+ return (MaxHistory) stream.readObject();
+ } finally {
+ stream.close();
+ }
+ }
+
+ private final Map durations = new HashMap();
+ private final Map failureTimestamps = new HashMap();
+ private final File historyStore;
private MaxHistory(File storedResults) {
- fHistoryStore = storedResults;
+ historyStore = storedResults;
}
private void save() throws IOException {
- ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(
- fHistoryStore));
+ ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(historyStore));
stream.writeObject(this);
stream.close();
}
Long getFailureTimestamp(Description key) {
- return fFailureTimestamps.get(key.toString());
+ return failureTimestamps.get(key.toString());
}
void putTestFailureTimestamp(Description key, long end) {
- fFailureTimestamps.put(key.toString(), end);
+ failureTimestamps.put(key.toString(), end);
}
boolean isNewTest(Description key) {
- return !fDurations.containsKey(key.toString());
+ return !durations.containsKey(key.toString());
}
Long getTestDuration(Description key) {
- return fDurations.get(key.toString());
+ return durations.get(key.toString());
}
void putTestDuration(Description description, long duration) {
- fDurations.put(description.toString(), duration);
+ durations.put(description.toString(), duration);
}
private final class RememberingListener extends RunListener {
diff --git a/src/main/java/org/junit/internal/ArrayComparisonFailure.java b/src/main/java/org/junit/internal/ArrayComparisonFailure.java
index 8627d6ec3308..b624026f4f7c 100644
--- a/src/main/java/org/junit/internal/ArrayComparisonFailure.java
+++ b/src/main/java/org/junit/internal/ArrayComparisonFailure.java
@@ -14,13 +14,8 @@ public class ArrayComparisonFailure extends AssertionError {
private static final long serialVersionUID = 1L;
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private final List fIndices = new ArrayList();
- private final String fMessage;
+ private final List indices = new ArrayList();
+ private final String message;
/**
* Construct a new ArrayComparisonFailure
with an error text and the array's
@@ -31,25 +26,25 @@ public class ArrayComparisonFailure extends AssertionError {
* @see Assert#assertArrayEquals(String, Object[], Object[])
*/
public ArrayComparisonFailure(String message, AssertionError cause, int index) {
- this.fMessage = message;
+ this.message = message;
initCause(cause);
addDimension(index);
}
public void addDimension(int index) {
- fIndices.add(0, index);
+ indices.add(0, index);
}
@Override
public String getMessage() {
StringBuilder sb = new StringBuilder();
- if (fMessage != null) {
- sb.append(fMessage);
+ if (message != null) {
+ sb.append(message);
}
sb.append("arrays first differed at element ");
- for (int each : fIndices) {
+ for (int index : indices) {
sb.append("[");
- sb.append(each);
+ sb.append(index);
sb.append("]");
}
sb.append("; ");
diff --git a/src/main/java/org/junit/internal/AssumptionViolatedException.java b/src/main/java/org/junit/internal/AssumptionViolatedException.java
index 880d73f9af60..f44d0629f964 100644
--- a/src/main/java/org/junit/internal/AssumptionViolatedException.java
+++ b/src/main/java/org/junit/internal/AssumptionViolatedException.java
@@ -13,27 +13,22 @@
* @see org.junit.Assume
*/
public class AssumptionViolatedException extends RuntimeException implements SelfDescribing {
- private static final long serialVersionUID = 2L;
+ private static final long serialVersionUID = 3L;
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private final String fAssumption;
- private final boolean fValueMatcher;
- private final Object fValue;
- private final Matcher> fMatcher;
+ private final String assumption;
+ private final boolean hasValue;
+ private final Object value;
+ private final Matcher> matcher;
/**
* @deprecated Please use {@link org.junit.AssumptionViolatedException} instead.
*/
@Deprecated
public AssumptionViolatedException(String assumption, boolean hasValue, Object value, Matcher> matcher) {
- this.fAssumption = assumption;
- this.fValue = value;
- this.fMatcher = matcher;
- this.fValueMatcher = hasValue;
+ this.assumption = assumption;
+ this.value = value;
+ this.matcher = matcher;
+ this.hasValue = hasValue;
if (value instanceof Throwable) {
initCause((Throwable) value);
@@ -89,23 +84,30 @@ public String getMessage() {
}
public void describeTo(Description description) {
- if (fAssumption != null) {
- description.appendText(fAssumption);
+ if (assumption != null) {
+ description.appendText(assumption);
+ }
+
+ if (hasValue) {
+ printValue(description);
+ printMatcher(description);
}
+ }
- if (fValueMatcher) {
- // a value was passed in when this instance was constructed; print it
- if (fAssumption != null) {
- description.appendText(": ");
- }
+ private void printValue(Description description) {
+ // a value was passed in when this instance was constructed; print it
+ if (assumption != null) {
+ description.appendText(": ");
+ }
- description.appendText("got: ");
- description.appendValue(fValue);
+ description.appendText("got: ");
+ description.appendValue(value);
+ }
- if (fMatcher != null) {
- description.appendText(", expected: ");
- description.appendDescriptionOf(fMatcher);
- }
+ private void printMatcher(Description description) {
+ if (matcher != null) {
+ description.appendText(", expected: ");
+ description.appendDescriptionOf(matcher);
}
}
}
diff --git a/src/main/java/org/junit/runner/Description.java b/src/main/java/org/junit/runner/Description.java
index fe47eacb537b..26be48b4f985 100644
--- a/src/main/java/org/junit/runner/Description.java
+++ b/src/main/java/org/junit/runner/Description.java
@@ -28,7 +28,7 @@
* @since 4.0
*/
public class Description implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 3L;
private static final Pattern METHOD_AND_CLASS_NAME_PATTERN = Pattern
.compile("([\\s\\S]*)\\((.*)\\)");
@@ -136,16 +136,11 @@ public static Description createSuiteDescription(Class> testClass) {
*/
public static final Description TEST_MECHANISM = new Description(null, "Test mechanism");
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private final Collection fChildren = new ConcurrentLinkedQueue();
- private final String fDisplayName;
- private final Serializable fUniqueId;
- private final Annotation[] fAnnotations;
- private volatile /* write-once */ Class> fTestClass;
+ private final Collection children = new ConcurrentLinkedQueue();
+ private final String displayName;
+ private final Serializable uniqueId;
+ private final Annotation[] annotations;
+ private volatile /* write-once */ Class> testClass;
private Description(Class> clazz, String displayName, Annotation... annotations) {
this(clazz, displayName, displayName, annotations);
@@ -160,17 +155,17 @@ private Description(Class> testClass, String displayName, Serializable uniqueI
throw new IllegalArgumentException(
"The unique id must not be null.");
}
- this.fTestClass = testClass;
- this.fDisplayName = displayName;
- this.fUniqueId = uniqueId;
- this.fAnnotations = annotations;
+ this.testClass = testClass;
+ this.displayName = displayName;
+ this.uniqueId = uniqueId;
+ this.annotations = annotations;
}
/**
* @return a user-understandable label
*/
public String getDisplayName() {
- return fDisplayName;
+ return displayName;
}
/**
@@ -179,7 +174,7 @@ public String getDisplayName() {
* @param description the soon-to-be child.
*/
public void addChild(Description description) {
- fChildren.add(description);
+ children.add(description);
}
/**
@@ -187,7 +182,7 @@ public void addChild(Description description) {
* Returns an empty list if there are no children.
*/
public ArrayList getChildren() {
- return new ArrayList(fChildren);
+ return new ArrayList(children);
}
/**
@@ -201,7 +196,7 @@ public boolean isSuite() {
* @return true
if the receiver is an atomic test
*/
public boolean isTest() {
- return fChildren.isEmpty();
+ return children.isEmpty();
}
/**
@@ -212,7 +207,7 @@ public int testCount() {
return 1;
}
int result = 0;
- for (Description child : fChildren) {
+ for (Description child : children) {
result += child.testCount();
}
return result;
@@ -220,7 +215,7 @@ public int testCount() {
@Override
public int hashCode() {
- return fUniqueId.hashCode();
+ return uniqueId.hashCode();
}
@Override
@@ -229,7 +224,7 @@ public boolean equals(Object obj) {
return false;
}
Description d = (Description) obj;
- return fUniqueId.equals(d.fUniqueId);
+ return uniqueId.equals(d.uniqueId);
}
@Override
@@ -249,7 +244,7 @@ public boolean isEmpty() {
* children will be added back)
*/
public Description childlessCopy() {
- return new Description(fTestClass, fDisplayName, fAnnotations);
+ return new Description(testClass, displayName, annotations);
}
/**
@@ -257,7 +252,7 @@ public Description childlessCopy() {
* or null if none exists
*/
public T getAnnotation(Class annotationType) {
- for (Annotation each : fAnnotations) {
+ for (Annotation each : annotations) {
if (each.annotationType().equals(annotationType)) {
return annotationType.cast(each);
}
@@ -269,7 +264,7 @@ public T getAnnotation(Class annotationType) {
* @return all of the annotations attached to this description node
*/
public Collection getAnnotations() {
- return Arrays.asList(fAnnotations);
+ return Arrays.asList(annotations);
}
/**
@@ -277,16 +272,16 @@ public Collection getAnnotations() {
* the class of the test instance.
*/
public Class> getTestClass() {
- if (fTestClass != null) {
- return fTestClass;
+ if (testClass != null) {
+ return testClass;
}
String name = getClassName();
if (name == null) {
return null;
}
try {
- fTestClass = Class.forName(name, false, getClass().getClassLoader());
- return fTestClass;
+ testClass = Class.forName(name, false, getClass().getClassLoader());
+ return testClass;
} catch (ClassNotFoundException e) {
return null;
}
@@ -297,7 +292,7 @@ public Class> getTestClass() {
* the name of the class of the test instance
*/
public String getClassName() {
- return fTestClass != null ? fTestClass.getName() : methodAndClassNamePatternGroupOrDefault(2, toString());
+ return testClass != null ? testClass.getName() : methodAndClassNamePatternGroupOrDefault(2, toString());
}
/**
@@ -313,4 +308,4 @@ private String methodAndClassNamePatternGroupOrDefault(int group,
Matcher matcher = METHOD_AND_CLASS_NAME_PATTERN.matcher(toString());
return matcher.matches() ? matcher.group(group) : defaultString;
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/junit/runner/Result.java b/src/main/java/org/junit/runner/Result.java
index 73ad059caefb..dfedfbd3ce49 100644
--- a/src/main/java/org/junit/runner/Result.java
+++ b/src/main/java/org/junit/runner/Result.java
@@ -23,7 +23,7 @@
* @since 4.0
*/
public class Result implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
private static final ObjectStreamField[] serialPersistentFields =
ObjectStreamClass.lookup(SerializedForm.class).getFields();
private final AtomicInteger count;
@@ -153,7 +153,7 @@ public RunListener createListener() {
* class match the files that {@code Result} had in JUnit 4.11.
*/
private static class SerializedForm implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
private final AtomicInteger fCount;
private final AtomicInteger fIgnoreCount;
private final List fFailures;
diff --git a/src/main/java/org/junit/runner/notification/Failure.java b/src/main/java/org/junit/runner/notification/Failure.java
index c03b4c181407..21186e60fb81 100644
--- a/src/main/java/org/junit/runner/notification/Failure.java
+++ b/src/main/java/org/junit/runner/notification/Failure.java
@@ -16,15 +16,10 @@
* @since 4.0
*/
public class Failure implements Serializable {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private final Description fDescription;
- private final Throwable fThrownException;
+ private final Description description;
+ private final Throwable thrownException;
/**
* Constructs a Failure
with the given description and exception.
@@ -33,22 +28,22 @@ public class Failure implements Serializable {
* @param thrownException the exception that was thrown while running the test
*/
public Failure(Description description, Throwable thrownException) {
- this.fThrownException = thrownException;
- this.fDescription = description;
+ this.thrownException = thrownException;
+ this.description = description;
}
/**
* @return a user-understandable label for the test
*/
public String getTestHeader() {
- return fDescription.getDisplayName();
+ return description.getDisplayName();
}
/**
* @return the raw description of the context of the failure.
*/
public Description getDescription() {
- return fDescription;
+ return description;
}
/**
@@ -56,12 +51,12 @@ public Description getDescription() {
*/
public Throwable getException() {
- return fThrownException;
+ return thrownException;
}
@Override
public String toString() {
- return getTestHeader() + ": " + fThrownException.getMessage();
+ return getTestHeader() + ": " + thrownException.getMessage();
}
/**
diff --git a/src/main/java/org/junit/runners/model/InitializationError.java b/src/main/java/org/junit/runners/model/InitializationError.java
index 841b565330be..b5213f54e626 100644
--- a/src/main/java/org/junit/runners/model/InitializationError.java
+++ b/src/main/java/org/junit/runners/model/InitializationError.java
@@ -9,21 +9,16 @@
* @since 4.5
*/
public class InitializationError extends Exception {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private final List fErrors;
+ private final List errors;
/**
* Construct a new {@code InitializationError} with one or more
* errors {@code errors} as causes
*/
public InitializationError(List errors) {
- this.fErrors = errors;
+ this.errors = errors;
}
public InitializationError(Throwable error) {
@@ -42,6 +37,6 @@ public InitializationError(String string) {
* Returns one or more Throwables that led to this initialization error.
*/
public List getCauses() {
- return fErrors;
+ return errors;
}
}
diff --git a/src/main/java/org/junit/runners/model/MultipleFailureException.java b/src/main/java/org/junit/runners/model/MultipleFailureException.java
index 6e458c28b7f3..4e8bb9e73d53 100644
--- a/src/main/java/org/junit/runners/model/MultipleFailureException.java
+++ b/src/main/java/org/junit/runners/model/MultipleFailureException.java
@@ -12,31 +12,26 @@
* @since 4.9
*/
public class MultipleFailureException extends Exception {
- private static final long serialVersionUID = 1L;
+ private static final long serialVersionUID = 2L;
- /*
- * We have to use the f prefix until the next major release to ensure
- * serialization compatibility.
- * See https://github.com/junit-team/junit/issues/976
- */
- private final List fErrors;
+ private final List errors;
public MultipleFailureException(List errors) {
if (errors.isEmpty()) {
throw new IllegalArgumentException("Argument error list cannot be empty");
}
- this.fErrors = new ArrayList(errors);
+ this.errors = new ArrayList(errors);
}
public List getFailures() {
- return Collections.unmodifiableList(fErrors);
+ return Collections.unmodifiableList(errors);
}
@Override
public String getMessage() {
StringBuilder sb = new StringBuilder(
- String.format("There were %d errors:", fErrors.size()));
- for (Throwable e : fErrors) {
+ String.format("There were %d errors:", errors.size()));
+ for (Throwable e : errors) {
sb.append(String.format("\n %s(%s)", e.getClass().getName(), e.getMessage()));
}
return sb.toString();
diff --git a/src/test/resources/junit/tests/runner/testRunFailureResultCanBeSerialised b/src/test/resources/junit/tests/runner/testRunFailureResultCanBeSerialised
index 79d8c014b3da..21b6a0bed3e7 100644
Binary files a/src/test/resources/junit/tests/runner/testRunFailureResultCanBeSerialised and b/src/test/resources/junit/tests/runner/testRunFailureResultCanBeSerialised differ
diff --git a/src/test/resources/junit/tests/runner/testRunSuccessResultCanBeSerialised b/src/test/resources/junit/tests/runner/testRunSuccessResultCanBeSerialised
index e5163d1e07b6..755a77aac885 100644
Binary files a/src/test/resources/junit/tests/runner/testRunSuccessResultCanBeSerialised and b/src/test/resources/junit/tests/runner/testRunSuccessResultCanBeSerialised differ