descriptions);
+
+ /** Context about the ordering being applied. */
+ public static class Context {
+ private final Description description;
+
+ /**
+ * Gets the description for the top-level target being ordered.
+ */
+ public Description getTarget() {
+ return description;
+ }
+
+ private Context(Description description) {
+ this.description = description;
+ }
+ }
+
+ /**
+ * Factory for creating {@link Ordering} instances.
+ *
+ * For a factory to be used with {@code @OrderWith} it needs to have a public no-arg
+ * constructor.
+ */
+ public interface Factory {
+ /**
+ * Creates an Ordering instance using the given context. Implementations
+ * of this method that do not need to use the context can return the
+ * same instance every time.
+ */
+ Ordering create(Context context);
+ }
+}
diff --git a/src/main/java/org/junit/runner/manipulation/Sorter.java b/src/main/java/org/junit/runner/manipulation/Sorter.java
index 20192d0c96e8..4b5274c31012 100644
--- a/src/main/java/org/junit/runner/manipulation/Sorter.java
+++ b/src/main/java/org/junit/runner/manipulation/Sorter.java
@@ -1,16 +1,21 @@
package org.junit.runner.manipulation;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Comparator;
+import java.util.List;
import org.junit.runner.Description;
/**
* A Sorter
orders tests. In general you will not need
- * to use a Sorter
directly. Instead, use {@link org.junit.runner.Request#sortWith(Comparator)}.
+ * to use a Sorter
directly. Instead, use
+ * {@link org.junit.runner.Request#sortWith(Comparator)}.
*
* @since 4.0
*/
-public class Sorter implements Comparator {
+public class Sorter extends Ordering implements Comparator {
/**
* NULL is a Sorter
that leaves elements in an undefined order
*/
@@ -27,17 +32,26 @@ public int compare(Description o1, Description o2) {
* to sort tests
*
* @param comparator the {@link Comparator} to use when sorting tests
+ * @since 4.0
*/
public Sorter(Comparator comparator) {
this.comparator = comparator;
}
/**
- * Sorts the test in runner
using comparator
+ * Sorts the tests in target
using comparator
.
+ *
+ * @since 4.0
*/
- public void apply(Object object) {
- if (object instanceof Sortable) {
- Sortable sortable = (Sortable) object;
+ @Override
+ public void apply(Object target) {
+ /*
+ * Note that all runners that are Orderable are also Sortable (because
+ * Orderable extends Sortable). Sorting is more efficient than ordering,
+ * so we override the parent behavior so we sort instead.
+ */
+ if (target instanceof Sortable) {
+ Sortable sortable = (Sortable) target;
sortable.sort(this);
}
}
@@ -45,4 +59,32 @@ public void apply(Object object) {
public int compare(Description o1, Description o2) {
return comparator.compare(o1, o2);
}
+
+ /**
+ * {@inheritDoc}
+ *
+ * @since 4.13
+ */
+ @Override
+ protected final List orderItems(Collection descriptions) {
+ /*
+ * In practice, we will never get here--Sorters do their work in the
+ * compare() method--but the Liskov substitution principle demands that
+ * we obey the general contract of Orderable. Luckily, it's trivial to
+ * implement.
+ */
+ List sorted = new ArrayList(descriptions);
+ Collections.sort(sorted, this); // Note: it would be incorrect to pass in "comparator"
+ return sorted;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @since 4.13
+ */
+ @Override
+ boolean validateOrderingIsCorrect() {
+ return false;
+ }
}
diff --git a/src/main/java/org/junit/runner/notification/RunListener.java b/src/main/java/org/junit/runner/notification/RunListener.java
index 9048c5016f37..d7cac003f1c6 100644
--- a/src/main/java/org/junit/runner/notification/RunListener.java
+++ b/src/main/java/org/junit/runner/notification/RunListener.java
@@ -76,7 +76,7 @@ public void testRunFinished(Result result) throws Exception {
*
* Note that not all runners will call this method, so runners should
* be prepared to handle {@link #testStarted(Description)} calls for tests
- * where there was no cooresponding {@code testSuiteStarted()} call for
+ * where there was no corresponding {@code testSuiteStarted()} call for
* the parent {@code Description}.
*
* @param description the description of the test suite that is about to be run
diff --git a/src/main/java/org/junit/runner/notification/SynchronizedRunListener.java b/src/main/java/org/junit/runner/notification/SynchronizedRunListener.java
index 0cd2f49444d7..400fed8fcebf 100644
--- a/src/main/java/org/junit/runner/notification/SynchronizedRunListener.java
+++ b/src/main/java/org/junit/runner/notification/SynchronizedRunListener.java
@@ -10,7 +10,7 @@
*
This class synchronizes all listener calls on a RunNotifier instance. This is done because
* prior to JUnit 4.12, all listeners were called in a synchronized block in RunNotifier,
* so no two listeners were ever called concurrently. If we instead made the methods here
- * sychronized, clients that added multiple listeners that called common code might see
+ * synchronized, clients that added multiple listeners that called common code might see
* issues due to the reduced synchronization.
*
* @author Tibor Digana (tibor17)
diff --git a/src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java b/src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java
index 8ce14d95ea07..455341aa0cb9 100644
--- a/src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java
+++ b/src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java
@@ -319,6 +319,7 @@ protected Object runReflectiveCall() throws Throwable {
statement = withBefores(method, test, statement);
statement = withAfters(method, test, statement);
statement = withRules(method, test, statement);
+ statement = withInterruptIsolation(statement);
return statement;
}
@@ -458,7 +459,7 @@ private long getTimeout(Test annotation) {
private static class RuleCollector implements MemberValueConsumer {
final List result = new ArrayList();
- public void accept(FrameworkMember member, T value) {
+ public void accept(FrameworkMember> member, T value) {
Rule rule = member.getAnnotation(Rule.class);
if (rule != null) {
RuleContainer container = CURRENT_RULE_CONTAINER.get();
diff --git a/src/main/java/org/junit/runners/Parameterized.java b/src/main/java/org/junit/runners/Parameterized.java
index 9dffb54b853b..d11b66a2d0c3 100644
--- a/src/main/java/org/junit/runners/Parameterized.java
+++ b/src/main/java/org/junit/runners/Parameterized.java
@@ -15,6 +15,7 @@
import org.junit.internal.AssumptionViolatedException;
import org.junit.runner.Description;
+import org.junit.runner.Result;
import org.junit.runner.Runner;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunNotifier;
@@ -184,6 +185,21 @@
* }
*
*
+ * Avoid creating parameters
+ * With {@link org.junit.Assume assumptions} you can dynamically skip tests.
+ * Assumptions are also supported by the @Parameters
method.
+ * Creating parameters is stopped when the assumption fails and none of the
+ * tests in the test class is executed. JUnit reports a
+ * {@link Result#getAssumptionFailureCount() single assumption failure} for the
+ * whole test class in this case.
+ *
+ * @Parameters
+ * public static Iterable<? extends Object> data() {
+ * String os = System.getProperty("os.name").toLowerCase()
+ * Assume.assumeTrue(os.contains("win"));
+ * return Arrays.asList("first test", "second test");
+ * }
+ *
* @since 4.0
*/
public class Parameterized extends Suite {
diff --git a/src/main/java/org/junit/runners/ParentRunner.java b/src/main/java/org/junit/runners/ParentRunner.java
index 4949c242e5b2..0a0e7cb6a583 100644
--- a/src/main/java/org/junit/runners/ParentRunner.java
+++ b/src/main/java/org/junit/runners/ParentRunner.java
@@ -7,18 +7,19 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
+import org.junit.FixMethodOrder;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.internal.AssumptionViolatedException;
@@ -31,8 +32,10 @@
import org.junit.runner.Runner;
import org.junit.runner.manipulation.Filter;
import org.junit.runner.manipulation.Filterable;
+import org.junit.runner.manipulation.Orderer;
+import org.junit.runner.manipulation.InvalidOrderingException;
import org.junit.runner.manipulation.NoTestsRemainException;
-import org.junit.runner.manipulation.Sortable;
+import org.junit.runner.manipulation.Orderable;
import org.junit.runner.manipulation.Sorter;
import org.junit.runner.notification.RunNotifier;
import org.junit.runner.notification.StoppedByUserException;
@@ -61,15 +64,15 @@
* @since 4.5
*/
public abstract class ParentRunner extends Runner implements Filterable,
- Sortable {
- private static final List VALIDATORS = Arrays.asList(
+ Orderable {
+ private static final List VALIDATORS = Collections.singletonList(
new AnnotationsValidator());
private final Lock childrenLock = new ReentrantLock();
private final TestClass testClass;
// Guarded by childrenLock
- private volatile Collection filteredChildren = null;
+ private volatile List filteredChildren = null;
private volatile RunnerScheduler scheduler = new RunnerScheduler() {
public void schedule(Runnable childStatement) {
@@ -212,6 +215,7 @@ protected Statement classBlock(final RunNotifier notifier) {
statement = withBeforeClasses(statement);
statement = withAfterClasses(statement);
statement = withClassRules(statement);
+ statement = withInterruptIsolation(statement);
}
return statement;
}
@@ -291,6 +295,22 @@ public void evaluate() {
};
}
+ /**
+ * @return a {@link Statement}: clears interrupt status of current thread after execution of statement
+ */
+ protected final Statement withInterruptIsolation(final Statement statement) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ try {
+ statement.evaluate();
+ } finally {
+ Thread.interrupted(); // clearing thread interrupted status for isolation
+ }
+ }
+ };
+ }
+
/**
* Evaluates whether a child is ignored. The default implementation always
* returns false
.
@@ -422,7 +442,7 @@ public void filter(Filter filter) throws NoTestsRemainException {
iter.remove();
}
}
- filteredChildren = Collections.unmodifiableCollection(children);
+ filteredChildren = Collections.unmodifiableList(children);
if (filteredChildren.isEmpty()) {
throw new NoTestsRemainException();
}
@@ -432,6 +452,10 @@ public void filter(Filter filter) throws NoTestsRemainException {
}
public void sort(Sorter sorter) {
+ if (shouldNotReorder()) {
+ return;
+ }
+
childrenLock.lock();
try {
for (T each : getFilteredChildren()) {
@@ -439,7 +463,47 @@ public void sort(Sorter sorter) {
}
List sortedChildren = new ArrayList(getFilteredChildren());
Collections.sort(sortedChildren, comparator(sorter));
- filteredChildren = Collections.unmodifiableCollection(sortedChildren);
+ filteredChildren = Collections.unmodifiableList(sortedChildren);
+ } finally {
+ childrenLock.unlock();
+ }
+ }
+
+ /**
+ * Implementation of {@link Orderable#order(Orderer)}.
+ *
+ * @since 4.13
+ */
+ public void order(Orderer orderer) throws InvalidOrderingException {
+ if (shouldNotReorder()) {
+ return;
+ }
+
+ childrenLock.lock();
+ try {
+ List children = getFilteredChildren();
+ // In theory, we could have duplicate Descriptions. De-dup them before ordering,
+ // and add them back at the end.
+ Map> childMap = new LinkedHashMap>(
+ children.size());
+ for (T child : children) {
+ Description description = describeChild(child);
+ List childrenWithDescription = childMap.get(description);
+ if (childrenWithDescription == null) {
+ childrenWithDescription = new ArrayList(1);
+ childMap.put(description, childrenWithDescription);
+ }
+ childrenWithDescription.add(child);
+ orderer.apply(child);
+ }
+
+ List inOrder = orderer.order(childMap.keySet());
+
+ children = new ArrayList(children.size());
+ for (Description description : inOrder) {
+ children.addAll(childMap.get(description));
+ }
+ filteredChildren = Collections.unmodifiableList(children);
} finally {
childrenLock.unlock();
}
@@ -449,6 +513,11 @@ public void sort(Sorter sorter) {
// Private implementation
//
+ private boolean shouldNotReorder() {
+ // If the test specifies a specific order, do not reorder.
+ return getDescription().getAnnotation(FixMethodOrder.class) != null;
+ }
+
private void validate() throws InitializationError {
List errors = new ArrayList();
collectInitializationErrors(errors);
@@ -457,12 +526,13 @@ private void validate() throws InitializationError {
}
}
- private Collection getFilteredChildren() {
+ private List getFilteredChildren() {
if (filteredChildren == null) {
childrenLock.lock();
try {
if (filteredChildren == null) {
- filteredChildren = Collections.unmodifiableCollection(getChildren());
+ filteredChildren = Collections.unmodifiableList(
+ new ArrayList(getChildren()));
}
} finally {
childrenLock.unlock();
@@ -494,16 +564,13 @@ public void setScheduler(RunnerScheduler scheduler) {
private static class ClassRuleCollector implements MemberValueConsumer {
final List entries = new ArrayList();
- public void accept(FrameworkMember member, TestRule value) {
+ public void accept(FrameworkMember> member, TestRule value) {
ClassRule rule = member.getAnnotation(ClassRule.class);
entries.add(new RuleContainer.RuleEntry(value, RuleContainer.RuleEntry.TYPE_TEST_RULE,
rule != null ? rule.order() : null));
}
public List getOrderedRules() {
- if (entries.isEmpty()) {
- return Collections.emptyList();
- }
Collections.sort(entries, RuleContainer.ENTRY_COMPARATOR);
List result = new ArrayList(entries.size());
for (RuleContainer.RuleEntry entry : entries) {
diff --git a/src/main/java/org/junit/runners/model/FrameworkField.java b/src/main/java/org/junit/runners/model/FrameworkField.java
index 9065d8324e08..e99d05b46312 100644
--- a/src/main/java/org/junit/runners/model/FrameworkField.java
+++ b/src/main/java/org/junit/runners/model/FrameworkField.java
@@ -47,7 +47,7 @@ public T getAnnotation(Class annotationType) {
@Override
public boolean isShadowedBy(FrameworkField otherMember) {
- return isStatic() && otherMember.getName().equals(getName());
+ return otherMember.getName().equals(getName());
}
@Override
diff --git a/src/main/java/org/junit/runners/model/FrameworkMember.java b/src/main/java/org/junit/runners/model/FrameworkMember.java
index 19e35f454591..5634b3f0ca98 100644
--- a/src/main/java/org/junit/runners/model/FrameworkMember.java
+++ b/src/main/java/org/junit/runners/model/FrameworkMember.java
@@ -12,13 +12,7 @@ public abstract class FrameworkMember> implements
Annotatable {
abstract boolean isShadowedBy(T otherMember);
- /**
- * Check if this member is shadowed by any of the given members. If it
- * is, the other member is removed.
- *
- * @return member that should be used, or {@code null} if no member should be used.
- */
- final T handlePossibleShadowedMember(List members) {
+ T handlePossibleBridgeMethod(List members) {
for (int i = members.size() - 1; i >=0; i--) {
T otherMember = members.get(i);
if (isShadowedBy(otherMember)) {
@@ -36,11 +30,6 @@ final T handlePossibleShadowedMember(List members) {
}
}
// No shadow or bridge method found. The caller should add *this* member.
- return self();
- }
-
- @SuppressWarnings("unchecked")
- private T self() {
return (T) this;
}
diff --git a/src/main/java/org/junit/runners/model/MemberValueConsumer.java b/src/main/java/org/junit/runners/model/MemberValueConsumer.java
index 351b23ef7889..a6157bf3be72 100644
--- a/src/main/java/org/junit/runners/model/MemberValueConsumer.java
+++ b/src/main/java/org/junit/runners/model/MemberValueConsumer.java
@@ -11,8 +11,8 @@ public interface MemberValueConsumer {
/**
* Receives the next value and its declaring member.
*
- * @param member declaring member ({@link FrameworkMethod or {@link FrameworkField}}
+ * @param member declaring member ({@link FrameworkMethod} or {@link FrameworkField})
* @param value the value of the next member
*/
- void accept(FrameworkMember member, T value);
+ void accept(FrameworkMember> member, T value);
}
diff --git a/src/main/java/org/junit/runners/model/RunnerBuilder.java b/src/main/java/org/junit/runners/model/RunnerBuilder.java
index bc6f85f04813..ba7c9e24d6ba 100644
--- a/src/main/java/org/junit/runners/model/RunnerBuilder.java
+++ b/src/main/java/org/junit/runners/model/RunnerBuilder.java
@@ -6,7 +6,11 @@
import java.util.Set;
import org.junit.internal.runners.ErrorReportingRunner;
+import org.junit.runner.Description;
+import org.junit.runner.OrderWith;
import org.junit.runner.Runner;
+import org.junit.runner.manipulation.InvalidOrderingException;
+import org.junit.runner.manipulation.Ordering;
/**
* A RunnerBuilder is a strategy for constructing runners for classes.
@@ -63,12 +67,25 @@ public abstract class RunnerBuilder {
*/
public Runner safeRunnerForClass(Class> testClass) {
try {
- return runnerForClass(testClass);
+ Runner runner = runnerForClass(testClass);
+ if (runner != null) {
+ configureRunner(runner);
+ }
+ return runner;
} catch (Throwable e) {
return new ErrorReportingRunner(testClass, e);
}
}
+ private void configureRunner(Runner runner) throws InvalidOrderingException {
+ Description description = runner.getDescription();
+ OrderWith orderWith = description.getAnnotation(OrderWith.class);
+ if (orderWith != null) {
+ Ordering ordering = Ordering.definedBy(orderWith.value(), description);
+ ordering.apply(runner);
+ }
+ }
+
Class> addParent(Class> parent) throws InitializationError {
if (!parents.add(parent)) {
throw new InitializationError(String.format("class '%s' (possibly indirectly) contains itself as a SuiteClass", parent.getName()));
diff --git a/src/main/java/org/junit/runners/model/TestClass.java b/src/main/java/org/junit/runners/model/TestClass.java
index 55b3e3b3e808..5962c2b478dc 100644
--- a/src/main/java/org/junit/runners/model/TestClass.java
+++ b/src/main/java/org/junit/runners/model/TestClass.java
@@ -84,7 +84,7 @@ protected static > void addToAnnotationLists(T memb
for (Annotation each : member.getAnnotations()) {
Class extends Annotation> type = each.annotationType();
List members = getAnnotatedMembers(map, type, true);
- T memberToAdd = member.handlePossibleShadowedMember(members);
+ T memberToAdd = member.handlePossibleBridgeMethod(members);
if (memberToAdd == null) {
return;
}
@@ -228,7 +228,7 @@ public List getAnnotatedFieldValues(Object test,
final List results = new ArrayList();
collectAnnotatedFieldValues(test, annotationClass, valueClass,
new MemberValueConsumer() {
- public void accept(FrameworkMember member, T value) {
+ public void accept(FrameworkMember> member, T value) {
results.add(value);
}
});
@@ -262,7 +262,7 @@ public List getAnnotatedMethodValues(Object test,
final List results = new ArrayList();
collectAnnotatedMethodValues(test, annotationClass, valueClass,
new MemberValueConsumer() {
- public void accept(FrameworkMember member, T value) {
+ public void accept(FrameworkMember> member, T value) {
results.add(value);
}
});
diff --git a/src/main/java/org/junit/validator/ValidateWith.java b/src/main/java/org/junit/validator/ValidateWith.java
index 03d790670f75..3725db81f954 100644
--- a/src/main/java/org/junit/validator/ValidateWith.java
+++ b/src/main/java/org/junit/validator/ValidateWith.java
@@ -1,8 +1,10 @@
package org.junit.validator;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Allows for an {@link AnnotationValidator} to be attached to an annotation.
@@ -13,6 +15,7 @@
* @since 4.12
*/
@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
@Inherited
public @interface ValidateWith {
Class extends AnnotationValidator> value();
diff --git a/src/site/fml/faq.fml b/src/site/fml/faq.fml
index b5a6bdddc792..bb8fe5e37cc3 100644
--- a/src/site/fml/faq.fml
+++ b/src/site/fml/faq.fml
@@ -128,15 +128,6 @@
-
-Where can I find articles on
- JUnit?
-
- The JUnit home page maintains a list
- of JUnit
- articles .
-
-
How is JUnit licensed?
@@ -315,7 +306,7 @@
Please stick to technical issues on the discussion forum and
mailing lists. Keep in mind that these are public, so
- do not include any confidental information in your
+ do not include any confidential information in your
questions!
@@ -346,7 +337,7 @@
JUnit is hosted
on GitHub .
+ href="http://github/junit-team/junit4">GitHub.
Please use the tools provided by GitHub for your
submissions.
@@ -1060,7 +1051,7 @@ oneTimeTearDown()
(Submitted by: Eric Armstrong)
- To run your JUnit tests, you'll need the following elemements in
+ To run your JUnit tests, you'll need the following elements in
your CLASSPATH:
@@ -1252,7 +1243,7 @@ oneTimeTearDown()
-DparameterName=parameterValue
- If the number of parameters on the command line gets unweildy,
+ If the number of parameters on the command line gets unwieldy,
pass in the location of a property file that defines a set of
parameters. Alternatively, the JUnit-addons package
@@ -1375,7 +1366,7 @@ excluded.8=net.jini.*
now you can have the reverse problem where the JUnit loader will
load a host of org.w3c.dom
/org.xml.sax
classes, and then the system loader violates the loader
- contraints at some point when it tries to do exactly what I
+ constraints at some point when it tries to do exactly what I
described above with JAXP because it doesn't ever delegate to
its logical child (the JUnit loader). Inevitably, if your test
cases use many JAXP and related XML classes, one or the other
@@ -1472,7 +1463,7 @@ a test failure, rather than the source file's line number?
DirectorySuiteBuilder builder = new DirectorySuiteBuilder();
builder.setSuffix("Test");
-Test suite = builer.suite("/home/project/myproject/tests");
+Test suite = builder.suite("/home/project/myproject/tests");
Documentation and examples are at http://junit-addons.sourceforge.net .
@@ -1708,14 +1699,6 @@ end
Miscellaneous
-
- How do I integrate JUnit with my IDE?
-
- The JUnit home page maintains a list of IDE integration
- instructions .
-
-
How do I launch a debugger when a test fails?
diff --git a/src/site/resources/css/carousel.css b/src/site/resources/css/carousel.css
new file mode 100644
index 000000000000..bc63d46add7c
--- /dev/null
+++ b/src/site/resources/css/carousel.css
@@ -0,0 +1,13 @@
+.carousel-content {
+ height: 20em;
+}
+.carousel-caption a {
+ color: #ffffff;
+}
+#junit-lambda-teaser {
+ background: url(../images/junit-lambda/background.png);
+ text-align: center;
+}
+#junit-lambda-teaser p {
+ padding-top: 25px;
+}
\ No newline at end of file
diff --git a/src/site/resources/css/junit-lambda.css b/src/site/resources/css/junit-lambda.css
new file mode 100644
index 000000000000..fbcb1feb0242
--- /dev/null
+++ b/src/site/resources/css/junit-lambda.css
@@ -0,0 +1,69 @@
+ul.inline {
+ margin-left: 0;
+ list-style: none;
+}
+.inline li {
+ display: inline-block;
+ margin-right: 10px;
+ margin-bottom: 10px;
+}
+
+.sponsors li {
+ border: 1px solid #e3e3e3;
+ -webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+}
+.sponsors li:hover {
+ border-color: #c5c5c5;
+}
+.sponsors li {
+ text-align: center;
+ padding: 0;
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+ -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
+}
+.sponsors li a {
+ display: block;
+ padding: 0 10px !important;
+}
+
+.sponsors-small li a img {
+ max-height: 100px;
+ max-width: 200px;
+}
+
+.sponsors-small li a {
+ width: 200px;
+ height: 120px;
+ line-height: 120px;
+}
+.sponsors-medium li a {
+ width: 278px;
+ height: 141px;
+ line-height: 141px;
+}
+.sponsors-large li a {
+ width: 435px;
+ height: 237px;
+ line-height: 237px;
+}
+
+ul.people {
+ margin-left: 7px;
+ margin-right: 7px;
+}
+.people li {
+ display: block;
+ width: 170px;
+ margin: 0;
+ padding: 0 15px 0 0;
+ float: left;
+ text-align: center;
+}
+.people img.avatar {
+ display: block;
+ width: 100%;
+ margin: 0 0 10px 0;
+}
diff --git a/src/site/resources/images/junit-lambda/background.png b/src/site/resources/images/junit-lambda/background.png
new file mode 100644
index 000000000000..ff8b1be8654c
Binary files /dev/null and b/src/site/resources/images/junit-lambda/background.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/42talents.png b/src/site/resources/images/junit-lambda/contributors/42talents.png
new file mode 100644
index 000000000000..cddcae9b5bfd
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/42talents.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/adnovum.png b/src/site/resources/images/junit-lambda/contributors/adnovum.png
new file mode 100644
index 000000000000..0743bed58bc2
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/adnovum.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/arcbees.png b/src/site/resources/images/junit-lambda/contributors/arcbees.png
new file mode 100755
index 000000000000..943325e0bf1a
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/arcbees.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/autotrader.jpg b/src/site/resources/images/junit-lambda/contributors/autotrader.jpg
new file mode 100644
index 000000000000..a20a8d69c11f
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/autotrader.jpg differ
diff --git a/src/site/resources/images/junit-lambda/contributors/bol.jpg b/src/site/resources/images/junit-lambda/contributors/bol.jpg
new file mode 100644
index 000000000000..ba0a4f73202e
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/bol.jpg differ
diff --git a/src/site/resources/images/junit-lambda/contributors/bouvet.png b/src/site/resources/images/junit-lambda/contributors/bouvet.png
new file mode 100644
index 000000000000..9f239ca57c93
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/bouvet.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/devnexus.png b/src/site/resources/images/junit-lambda/contributors/devnexus.png
new file mode 100644
index 000000000000..fa6d6ea25885
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/devnexus.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/diffplug.png b/src/site/resources/images/junit-lambda/contributors/diffplug.png
new file mode 100644
index 000000000000..e663310f72f4
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/diffplug.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/disy.jpg b/src/site/resources/images/junit-lambda/contributors/disy.jpg
new file mode 100644
index 000000000000..99210e522eab
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/disy.jpg differ
diff --git a/src/site/resources/images/junit-lambda/contributors/eclipse.png b/src/site/resources/images/junit-lambda/contributors/eclipse.png
new file mode 100755
index 000000000000..47db56d82ac3
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/eclipse.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/ergon.png b/src/site/resources/images/junit-lambda/contributors/ergon.png
new file mode 100644
index 000000000000..70c2014ba387
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/ergon.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/gradle.png b/src/site/resources/images/junit-lambda/contributors/gradle.png
new file mode 100644
index 000000000000..ed603e574563
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/gradle.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/intellijidea.png b/src/site/resources/images/junit-lambda/contributors/intellijidea.png
new file mode 100644
index 000000000000..5d9edbf29a2d
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/intellijidea.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/klarna.png b/src/site/resources/images/junit-lambda/contributors/klarna.png
new file mode 100644
index 000000000000..9122da6b4c76
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/klarna.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/klosebrothers.png b/src/site/resources/images/junit-lambda/contributors/klosebrothers.png
new file mode 100644
index 000000000000..6ff579789d33
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/klosebrothers.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/msgsystems.png b/src/site/resources/images/junit-lambda/contributors/msgsystems.png
new file mode 100644
index 000000000000..68850ccc202e
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/msgsystems.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/murex.jpg b/src/site/resources/images/junit-lambda/contributors/murex.jpg
new file mode 100644
index 000000000000..a86019ff4b1c
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/murex.jpg differ
diff --git a/src/site/resources/images/junit-lambda/contributors/netcetera.png b/src/site/resources/images/junit-lambda/contributors/netcetera.png
new file mode 100644
index 000000000000..8520f90efe1b
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/netcetera.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/novatec.png b/src/site/resources/images/junit-lambda/contributors/novatec.png
new file mode 100644
index 000000000000..b5a6ee3b1c18
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/novatec.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/ociweb.png b/src/site/resources/images/junit-lambda/contributors/ociweb.png
new file mode 100644
index 000000000000..36cb8d92106f
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/ociweb.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/oio.png b/src/site/resources/images/junit-lambda/contributors/oio.png
new file mode 100644
index 000000000000..66ce7e397287
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/oio.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/red6-es.jpg b/src/site/resources/images/junit-lambda/contributors/red6-es.jpg
new file mode 100644
index 000000000000..f4bdb869e696
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/red6-es.jpg differ
diff --git a/src/site/resources/images/junit-lambda/contributors/samuraism.png b/src/site/resources/images/junit-lambda/contributors/samuraism.png
new file mode 100644
index 000000000000..fa804899097b
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/samuraism.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/siili.png b/src/site/resources/images/junit-lambda/contributors/siili.png
new file mode 100644
index 000000000000..a757885fb660
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/siili.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/sipgate.png b/src/site/resources/images/junit-lambda/contributors/sipgate.png
new file mode 100644
index 000000000000..31cc742527fb
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/sipgate.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/six.gif b/src/site/resources/images/junit-lambda/contributors/six.gif
new file mode 100644
index 000000000000..19f111831ba1
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/six.gif differ
diff --git a/src/site/resources/images/junit-lambda/contributors/sonrisa.png b/src/site/resources/images/junit-lambda/contributors/sonrisa.png
new file mode 100644
index 000000000000..350e0df1042d
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/sonrisa.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/squeed.png b/src/site/resources/images/junit-lambda/contributors/squeed.png
new file mode 100644
index 000000000000..275f663c8795
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/squeed.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/structure101.png b/src/site/resources/images/junit-lambda/contributors/structure101.png
new file mode 100644
index 000000000000..f57ece9ae304
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/structure101.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/synyx.jpg b/src/site/resources/images/junit-lambda/contributors/synyx.jpg
new file mode 100755
index 000000000000..5143a738fec8
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/synyx.jpg differ
diff --git a/src/site/resources/images/junit-lambda/contributors/tng.png b/src/site/resources/images/junit-lambda/contributors/tng.png
new file mode 100644
index 000000000000..94db5512ebd2
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/tng.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/topdesk.png b/src/site/resources/images/junit-lambda/contributors/topdesk.png
new file mode 100644
index 000000000000..2a1d50c5767f
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/topdesk.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/vaddy.png b/src/site/resources/images/junit-lambda/contributors/vaddy.png
new file mode 100644
index 000000000000..b595aef46558
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/vaddy.png differ
diff --git a/src/site/resources/images/junit-lambda/contributors/zenika.png b/src/site/resources/images/junit-lambda/contributors/zenika.png
new file mode 100644
index 000000000000..a83250c36573
Binary files /dev/null and b/src/site/resources/images/junit-lambda/contributors/zenika.png differ
diff --git a/src/site/resources/images/junit-lambda/junit-lambda-logo.png b/src/site/resources/images/junit-lambda/junit-lambda-logo.png
new file mode 100644
index 000000000000..d14a985e9f64
Binary files /dev/null and b/src/site/resources/images/junit-lambda/junit-lambda-logo.png differ
diff --git a/src/site/resources/images/junit-lambda/sponsors/amex.png b/src/site/resources/images/junit-lambda/sponsors/amex.png
new file mode 100644
index 000000000000..8f9d2f3c5a0c
Binary files /dev/null and b/src/site/resources/images/junit-lambda/sponsors/amex.png differ
diff --git a/src/site/resources/images/junit-lambda/sponsors/andrena.png b/src/site/resources/images/junit-lambda/sponsors/andrena.png
new file mode 100644
index 000000000000..bd3663c5cc47
Binary files /dev/null and b/src/site/resources/images/junit-lambda/sponsors/andrena.png differ
diff --git a/src/site/resources/images/junit-lambda/sponsors/heidelberg-mobil.png b/src/site/resources/images/junit-lambda/sponsors/heidelberg-mobil.png
new file mode 100644
index 000000000000..2e3046a8f8eb
Binary files /dev/null and b/src/site/resources/images/junit-lambda/sponsors/heidelberg-mobil.png differ
diff --git a/src/site/resources/images/junit-lambda/sponsors/namics.png b/src/site/resources/images/junit-lambda/sponsors/namics.png
new file mode 100644
index 000000000000..3a30b5205a30
Binary files /dev/null and b/src/site/resources/images/junit-lambda/sponsors/namics.png differ
diff --git a/src/site/resources/images/junit-lambda/sponsors/pivotal.png b/src/site/resources/images/junit-lambda/sponsors/pivotal.png
new file mode 100644
index 000000000000..1ee4d0c8eeee
Binary files /dev/null and b/src/site/resources/images/junit-lambda/sponsors/pivotal.png differ
diff --git a/src/site/resources/images/junit5-banner.png b/src/site/resources/images/junit5-banner.png
new file mode 100644
index 000000000000..76a1243ddc28
Binary files /dev/null and b/src/site/resources/images/junit5-banner.png differ
diff --git a/src/site/resources/scripts/index.js b/src/site/resources/scripts/index.js
index 9e1486ec601c..043f1df72734 100644
--- a/src/site/resources/scripts/index.js
+++ b/src/site/resources/scripts/index.js
@@ -1,6 +1,6 @@
$(document).ready(function(){
$('#main-carousel').carousel({
- interval:5000
+ interval:10000
});
$('#main-carousel-prev').on("click", function () {
diff --git a/src/site/site.xml b/src/site/site.xml
index 323f6eb065f6..89d1463a000f 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd">
${project.name}
- http://junit.org/images/junit-logo.png
+ ./images/junit-logo.png
http://junit.org/
@@ -12,7 +12,6 @@
-
@@ -24,18 +23,20 @@
+
+
-
+
-
+
-
+
@@ -45,7 +46,7 @@
false
true
- junit-team/junit
+ junit-team/junit4
right
diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml
index d50b470a3360..dc13888e2408 100644
--- a/src/site/xdoc/index.xml
+++ b/src/site/xdoc/index.xml
@@ -14,8 +14,17 @@
-
-
+
+
+
+
+
+
+
+
@Test
public void newArrayListsHaveNoElements() {
@@ -38,12 +47,12 @@
-
+
@Test
public void lookupEmailAddresses() {
assertThat(new CartoonCharacterEmailLookupService().getResults("looney"), allOf(
- not(empty()),
+ not(empty()),
containsInAnyOrder(
allOf(instanceOf(Map.class), hasEntry("id", "56"), hasEntry("email", "roadrunner@fast.org")),
allOf(instanceOf(Map.class), hasEntry("id", "76"), hasEntry("email", "wiley@acme.com"))
@@ -78,6 +87,7 @@
Getting started
Release Notes
+4.13
4.12
4.11
4.10
@@ -125,7 +135,7 @@
System Rules – A collection of JUnit rules for testing code that uses java.lang.System.
-JUnit Toolbox - Provides runners for parallel testing, a PoolingWait
class to ease asynchronous testing, and a WildcardPatternSuite
which allow you to specify wildcard patterns instead of explicitly listing all classes when you create a suite class.
+JUnit Toolbox - Provides runners for parallel testing, a PoolingWait
class to ease asynchronous testing, and a WildcardPatternSuite
which allow you to specify wildcard patterns instead of explicitly listing all classes when you create a suite class.
junit-quickcheck - QuickCheck-style parameter suppliers for JUnit theories. Uses junit.contrib's version of the theories machinery , which respects generics on theory parameters.
@@ -150,7 +160,7 @@
content: "Don't forget that the documentation generated by Maven is hiding up here"
},
{
- target: $('body a[href="http://github.com/junit-team/junit"] img')[0],
+ target: $('body a[href="http://github.com/junit-team/junit4"] img')[0],
placement: "left",
title: "Source code",
content: "The source code for JUnit is hosted on GitHub"
diff --git a/src/site/xhtml/junit-lambda-campaign.xhtml b/src/site/xhtml/junit-lambda-campaign.xhtml
new file mode 100644
index 000000000000..fa932c808c79
--- /dev/null
+++ b/src/site/xhtml/junit-lambda-campaign.xhtml
@@ -0,0 +1,67 @@
+
+
+
JUnit Lambda Crowdfunding Campaign
+
+
+
Crowdfunding JUnit Lambda #fundJUnit
+
+
+
+
+
The crowdfunding campaign has successfully ended. Thank you all!
+
+ Campaign page on Indiegogo
+ Campaign Contributors
+ Follow @junitteam on Twitter
+
+
+
Main Sponsors
+
Each of these companies will fund a developer for 6 weeks. They will not receive any money collected through the campaign.
+
+
Main Campaign Sponsor
+
This company will fund JUnit Lambda through the Main Sponsor campaign perk.
+
+
Campaign Contributors
+
Thank you to all other people, companies, and organizations that have contributed already! Please check out our contributors page .
+
+
Why JUnit needs your support
+
With 43 million downloads from Maven Central in 2014 JUnit still is the default testing library for Java. Millions of projects rely on it being both stable and allowing to test the latest features of the latest JDK. Moreover, many other testing libraries hook into JUnit as a way to enable IDE and build tool integration. Keeping JUnit in shape is a major task for those maintaining and evolving the library.
+
As of today, none of the active JUnit maintainers are payed by their employer to do this work. Not surprisingly many unresolved issues have piled up and, what’s worse, there is no hope to get JUnit to support and make use of all the features in Java 8 any time soon. Since Lambdas are the most prominent of those features, we borrowed their name for the campaign.
+
This campaign will allow a team of long-time JUnit committers, backed by a few experienced Java developers, to focus on getting JUnit ready for the years—and JDKs—to come.
+
Obstacles for evolving JUnit
+
A major design goal of JUnit has always been simplicity. JUnit 4 was released 10 years ago and has served its purpose very well. Since then many things have changed: Java got a couple of new versions and many new testing frameworks and ideas about testing have popped up.
+
The basic design of JUnit, however, has remained the same since 2005. Some constructs like Rules were added, but at the same time backwards compatibility has always been and will continue to be the major goal of evolving JUnit. A number of issues have increasingly slowed down its evolution:
+
+
+ Runners have found a widespread use and become a crucial concept to extend JUnit. Writing a custom runner is a very powerful way to customize how a test class is instantiated, how its children are collected, how they are run, reported, and so on. However, you can only have a single runner for each test class. For example, combining SpringJUnit4ClassRunner and Parameterized is not possible at the moment. We want to separate the different concerns, for which the runner is currently responsible, into separated interfaces.
+
+
+ The current execution model requires all test cases to be known a-priori. This prevents the dynamic creation of test cases as response to observed behaviour during test execution. This also means that you cannot use Streams (Java 8), e.g. in combination with @Parameters , to create your test data.
+
+
+ All IDEs and build tools include support for JUnit. While that makes it really easy to execute JUnit tests, on the flip side the IDEs and build tools are tightly coupled to JUnit internals. Some IDEs and build tools use internal JUnit classes or even reflection to circumvent the absence of a JUnit API that does what they want. For example, there is no extensible way to link to a test location in case it is not a Java method. Those “tricks” complicate the evolution of JUnit tremendously, and even render some changes virtually impossible. Therefore, we want to closely work with IDE and build tool developers to add features their users need in an extensible way.
+
+
+
The Vision
+
We’ve identified two main areas to focus on during the upcoming JUnit overhaul:
+
+
+ Decouple test execution and reporting from test definition and provisioning : This will greatly simplify further evolution of JUnit and allow users to mix test specifications from different test libraries—like JUnit, Spock, ScalaTest and so on—more easily. Other testing libraries should only depend on the test execution/reporting API of JUnit, not on the test definition API (e.g. Runner).
+
+
+ Rethinking the JUnit’s extensibility story : Runners, Rules, subclassing and other techniques will be revamped into a cohesive set of constructs to enhance JUnit and to allow—if possible—the seamless combination of individual extensions.
+
+
+ Making use of Java 8 features (Lambdas, Streams, Interface default methods) for better assertions, generating test cases, formulating test hierarchies, testing asynchronous code and other stuff : We will provide those extensions in additional libraries to keep the JUnit core compatible with older JDKs.
+
+
+
All development will happen openly on GitHub in order to foster early feedback and detect problems as soon as possible.
+
+
diff --git a/src/site/xhtml/junit-lambda-contributors.xhtml b/src/site/xhtml/junit-lambda-contributors.xhtml
new file mode 100644
index 000000000000..fad6d5355dd9
--- /dev/null
+++ b/src/site/xhtml/junit-lambda-contributors.xhtml
@@ -0,0 +1,326 @@
+
+
+
JUnit Lambda
+
+
+
Crowdfunding Campaign Contributors #fundJUnit
+
The following individuals, companies, and organizations have made substantial contributions to the JUnit Lambda crowdfunding campaign on Indiegogo . Thank you from the JUnit team!
+
Depending on the perk they have chosen, they are listed with a large logo, a small one, or by their name.
+
+
+
+ Hans Sowa
+ Jens Schauder
+ Tobias Ahlers
+ Daniel Zappold
+ Kai-Marian Pukall
+ Julien Jakubowski
+ Dmitry Karlinsky
+ Mark Munson
+ Andrew Janke
+ Eric Lefevre-Ardant
+ Brett Tucker
+ Andi Scharfstein
+ Oyvind Horneland
+ Görge Albrecht
+ Justin Ryan
+ Maria Savela
+ Eugen Parasachiv
+ Stefan Domnanovits
+ Nils Wloka
+ Eduardo Ucha Tortuero
+ Mark Crossfield
+ Benjamin Murray
+ MinGyoo Jung
+ Hadrien Zalek
+ Khaled Sinno
+ Chadi El Masri
+ Davide Fucci
+ Frederik Hahne
+ Benjamin Murray
+ Erik Severinsen
+ Anna-Pitschna Kunz
+ Daniel Baldes
+ Stefan Ferstl
+ Jonathan Gray
+ Seb Heglmeier
+ Bruno Girin
+ Steve Ash
+ Yves Geissbuehler
+ Jacques Stadler
+ Bernard D'Havé
+ Monica Granbois
+ Florian Hopf
+ Erich Oswald
+ Joe Schmetzer
+ Sebastian Hempel
+ Christoph Pater
+ Klaus Unger
+ Martijn Dashorst
+ Alexey Kornev
+ Timo Kockert
+ Michael Prieß
+ Joseph Moore
+ Richard Capraro
+ J. B. Rainsberger
+ Marcel Körtgen
+ Tim Yates
+ Evan Porter
+ Jeroen Ingelbrecht
+ Mustafa Ulu
+ Daniel Wellman
+ Juan Llado
+ Michał Bendowski
+ Samir Talwar
+ David Tanzer
+ Siv Midtun Hollup
+ Alexander Schwartz
+ Oliver Paulus
+ Micael Gallego
+ Johannes Seitz
+ Tristan Mills
+ Henk van Voorthuijsen
+ Dennis Hunziker
+ Stefan Odendahl
+ Gregor Trefs
+ Steve Moyer
+ Björn Kimminich
+ Fabrice Sznajderman
+ Nikita Makarov
+ Carsten Otto
+ Markus Decke
+ Henrik Steudel
+ Matt Newell
+ Thomas Michael
+ Robert Klaus
+ Martin Dürrmeier
+ Petri Kainulainen
+ Jean-Christophe Sirot
+ Max Schwaab
+ Brian Clozel
+ Per-Ingemar Andersson
+ Henry Voyer
+ Greg Roodt
+ Java User Group Frankfurt
+ Adrian McMichael
+ Björn Darri Sigurðsson
+ Chris Williams
+ Agile Pain Relief Consulting
+ Andrew Beussink
+ Per Arnold Blaasmo
+ Ian Mayo
+ Doyle Young
+ Wolfgang Werner
+ Daniel Kunz
+ Benjamin Herbert
+ Axel Schüssler
+ Matthias Lünemann
+ Christophe Taret
+ Stephen Starkey
+ Michael Dörsam
+ Matt Bertolini
+ Jun Yong Chong
+ Svante Kumlien
+ Matt Garner
+ Patrick Podbregar
+ Alessandro Proscia
+ David Burkhart
+ Matthias Grund
+ Tomas Michalec
+ Tadaya Tsuyukubo
+ Frank Appel
+ Paul Holser
+ Patrick Baumgartner
+ Emmanuel Chavane
+ Kini
+ Robert-Jan Regout
+ Bastian Spanneberg
+ Jérémie Bresson
+ Harald Brabenetz
+ Nacho Cougil
+ Martin Schröder
+ Thorsten Brunzendorf
+ Paolo Escobar
+ Brad Milne
+ Bill Chen
+ Craig Doremus
+ Jean-Michel Bea
+ Thorsten Göckeler
+ Ben Romberg
+ Sixto Cantolla Sánchez
+ Altiria
+ Andres Rodriguez
+ Romain Rocès
+ Ivan Caspeta
+ Oliver Gierke
+ Pierre Marguerite
+ Dmitry Spikhalskiy
+ Francisco Javier Jiménez Sáez
+ Ivo Smid
+ Sargon
+ Balázs Sándor Mracskó
+ Marco Fritschi
+ Matthias 'Yolgie' Holzinger
+ Christian Schubert
+ Rémy Francillette
+ Martin Klose
+ tennisoff.net
+ Yoshio Terada
+ Oleg Lavorskyi
+ Marvin Lillehaug
+ y.ono
+ Kouji Nomura
+ Takuto Wada
+ Teruaki Kanamori
+ Keita Kita
+ Manabu Matsuzaki
+ Sato Taichi
+ Koji Hasegawa
+ Lukas Hinsch
+ Hirofumi Nakagawa
+ Chanwook
+ Masashi Yoshida
+ Yusuke Ikeda
+ Takafumi Yoshida
+ Iwao Harada
+ Daisuke Nakagome
+ Yasushi Hagai
+ Takuya Kawabe
+ Oohara Kazutaka
+ Itsuo Okamoto
+ Shigeyuki Azuchi
+ Shinya Kamijo
+ Noritaka Ishizumi
+ Cagatay Kavukcuoglu
+ Lars Vogel
+ Koji LIn
+ Elmar Fasel
+ Behrang Saeedzadeh
+ Paul Naranja
+ Naoko Yamazaki
+ Kouta Imanaka
+ Takahiro Yano
+ Minoru Yokomichi
+ Yuki Matsumura
+ Kazutoshi Tanaka
+ Itsuki Kuroda
+ Alexander Golonzovsky
+ Ryo Uchino
+ Shingo Ishimura
+ Yamamoto Masaki
+ 幸田英隆
+ Hiroyuki Ohnaka
+ Ito Sho
+ Yu Asano
+ Takeshi Hagikura
+ Shigeki Yamato
+ Shinya Yoshida
+ Dimitrios Liapis
+ Kohei Yamamoto
+ Hiroto Kusuda
+ Jonas Lindholm
+ Takumi Endo
+ Gabi Merten
+ Ben Hale
+ Eiji Hachiya
+ Hideyuki Kikuma
+ Park Sungchul
+ Eiji Yamane
+ Akinori Ikeda
+ Jun Nakamura
+ Takuya Shimabukuro
+ Setsu Fujita
+ Jochen Winzen
+ Yousuke Tezuka
+ Shimizu Yasuhiro
+ Satoshi Okano
+ Yasuyuki Fukai
+ Charles Goddard
+ Tiarê Balbi Bonamini
+ Kazumune Katagiri
+ Masahiro Wakame
+ Kazutaka Ogaki
+ Taizo Nakatani
+ Yoshitaka Kawaji
+ Akihiro Kitada
+ Kozaki Tsuneaki
+ Takehiro Inoue
+ Shigeki Shoji
+ Junya Suzuki
+ Tomoharu Nagasawa
+ Toby Lee
+ Yuichiro Mukai
+ Hiroyuki Yamaoka
+ Jun Sagawa
+ Soma Kuwabara
+ Yui Iwamatsu
+ Michael Schlechter
+ Hiroshi Ito
+ Tae-jun Jin
+ Dennis Rippinger
+ Dejan Janosevic
+ Dbj Shrestha
+ Hideaki Takahashi
+ Daigo Ikeda
+ Teppei Yamaguchi
+ Pierre Templier
+ TDD Base Camp
+ Hirofumi Nozaki
+ Takayuki Hayashi
+ Steven Christou
+ Kostadin Golev
+ Ricardo Gladwell
+ Thorsten Hoeger
+ Markus Gärtner
+ Hiroyuki Aoki
+ Gary Fleming
+ Samuel Eickelberg
+ Marcel Berschneider
+ Frank Jakop
+ Dominik Lange
+ Stefan Matzdorf
+ Suzanne Hamilton
+ Satoru Kimura
+ 今井一幾
+ Yasuharu Nakano
+ Takatoshi Kawamura
+
+
+
diff --git a/src/site/xhtml/junit-lambda-spending.xhtml b/src/site/xhtml/junit-lambda-spending.xhtml
new file mode 100644
index 000000000000..8125c1ce74a7
--- /dev/null
+++ b/src/site/xhtml/junit-lambda-spending.xhtml
@@ -0,0 +1,29 @@
+
+
+
JUnit Lambda - Campaign Spending
+
+
+
JUnit Lambda - Spending
+
+ Since all the money is going through the books of a company (andrena objects ag),
+ the exact amount for taxes cannot be calculated. We will fill in details and
+ exact amounts for other positions as soon as we have them.
+
+
+ What Credit/EUR Debit/EUR Balance/EUR
+ Indiegogo Sum €53,937.00 €53,937.00
+ Indiegogo Fees (5%) €2,696.85 €51,240.15
+ Paypal Fees €2,270.06 €48,970.09
+ German VAT (estimated) €7,666.49 €41,303.60
+ Kick-off Expenses, Travel and Food €3,011.32 €38,292.28
+ Development October 2015 €14,000.00 €24,292.28
+ Development November 2015 €7,600.00 €16,692.28
+ Development December 2015 €5,400.00 €11,292.28
+ Travel Expenses December 2015 €749.69 €10,542.59
+ Development January 2016 €6,000.00 €4,542.59
+ Travel Expenses January 2016 €1,001.13 €3,541.46
+ Development April 2016 €1,200.00 €2,341.46
+ Development August 2016 €2,341.46 €0.00
+
+
+
diff --git a/src/site/xhtml/junit-lambda.xhtml b/src/site/xhtml/junit-lambda.xhtml
new file mode 100644
index 000000000000..ce0752fb55d1
--- /dev/null
+++ b/src/site/xhtml/junit-lambda.xhtml
@@ -0,0 +1,30 @@
+
+
+
JUnit Lambda
+
+
+
JUnit Lambda
+
+ JUnit Lambda was the working title for
+ what has now become JUnit 5 .
+
+
+ The initial phases of this work were enabled by a crowdfunding campaign on Indiegogo .
+
+
+
Campaign Spending
+
+ As part of our accountability we agreed to make all campaign spending transparent .
+
+
+
Main Sponsors and Campaign Sponsor
+
Without sponsoring JUnit Lambda would not exist. We're especially grateful to the companies below:
+
+
+
diff --git a/src/site/xhtml/junit5.xhtml b/src/site/xhtml/junit5.xhtml
new file mode 100644
index 000000000000..d0f7b6f98d84
--- /dev/null
+++ b/src/site/xhtml/junit5.xhtml
@@ -0,0 +1,11 @@
+
+
+
JUnit 5
+
+
+
JUnit 5
+
+ This page has moved to http://junit.org/junit5/ .
+
+
+
diff --git a/src/test/java/org/junit/AssumptionViolatedExceptionTest.java b/src/test/java/org/junit/AssumptionViolatedExceptionTest.java
index b082933bc9af..574cdb13059d 100644
--- a/src/test/java/org/junit/AssumptionViolatedExceptionTest.java
+++ b/src/test/java/org/junit/AssumptionViolatedExceptionTest.java
@@ -3,7 +3,7 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeThat;
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;
diff --git a/src/test/java/org/junit/experimental/categories/CategoryTest.java b/src/test/java/org/junit/experimental/categories/CategoryTest.java
index 3d3ad682ce1d..59242b447cfa 100644
--- a/src/test/java/org/junit/experimental/categories/CategoryTest.java
+++ b/src/test/java/org/junit/experimental/categories/CategoryTest.java
@@ -1,8 +1,8 @@
package org.junit.experimental.categories;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.experimental.results.PrintableResult.testResult;
diff --git a/src/test/java/org/junit/experimental/categories/CategoryValidatorTest.java b/src/test/java/org/junit/experimental/categories/CategoryValidatorTest.java
index 84042e9a0513..654622f594bf 100644
--- a/src/test/java/org/junit/experimental/categories/CategoryValidatorTest.java
+++ b/src/test/java/org/junit/experimental/categories/CategoryValidatorTest.java
@@ -1,7 +1,7 @@
package org.junit.experimental.categories;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.List;
diff --git a/src/test/java/org/junit/internal/StackTracesTest.java b/src/test/java/org/junit/internal/StackTracesTest.java
index f9e7078bc95f..748d86a5f9e8 100644
--- a/src/test/java/org/junit/internal/StackTracesTest.java
+++ b/src/test/java/org/junit/internal/StackTracesTest.java
@@ -1,8 +1,8 @@
package org.junit.internal;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
diff --git a/src/test/java/org/junit/internal/builders/AnnotatedBuilderTest.java b/src/test/java/org/junit/internal/builders/AnnotatedBuilderTest.java
index 9879d3a5228d..8c8f095bef46 100644
--- a/src/test/java/org/junit/internal/builders/AnnotatedBuilderTest.java
+++ b/src/test/java/org/junit/internal/builders/AnnotatedBuilderTest.java
@@ -3,7 +3,7 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.hamcrest.core.IsNull.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.Runner;
diff --git a/src/test/java/org/junit/internal/matchers/StacktracePrintingMatcherTest.java b/src/test/java/org/junit/internal/matchers/StacktracePrintingMatcherTest.java
index 3bd2c54b4d04..2f22c9620873 100644
--- a/src/test/java/org/junit/internal/matchers/StacktracePrintingMatcherTest.java
+++ b/src/test/java/org/junit/internal/matchers/StacktracePrintingMatcherTest.java
@@ -4,8 +4,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.internal.matchers.StacktracePrintingMatcher.isException;
import static org.junit.internal.matchers.StacktracePrintingMatcher.isThrowable;
diff --git a/src/test/java/org/junit/internal/matchers/ThrowableCauseMatcherTest.java b/src/test/java/org/junit/internal/matchers/ThrowableCauseMatcherTest.java
index dba1f7b2ce03..8a169c77dd75 100644
--- a/src/test/java/org/junit/internal/matchers/ThrowableCauseMatcherTest.java
+++ b/src/test/java/org/junit/internal/matchers/ThrowableCauseMatcherTest.java
@@ -3,7 +3,7 @@
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.internal.matchers.ThrowableCauseMatcher.hasCause;
public class ThrowableCauseMatcherTest {
diff --git a/src/test/java/org/junit/internal/runners/statements/ExpectExceptionTest.java b/src/test/java/org/junit/internal/runners/statements/ExpectExceptionTest.java
index 568d0b6bfa89..466e28917a68 100644
--- a/src/test/java/org/junit/internal/runners/statements/ExpectExceptionTest.java
+++ b/src/test/java/org/junit/internal/runners/statements/ExpectExceptionTest.java
@@ -6,7 +6,7 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
/**
diff --git a/src/test/java/org/junit/rules/BlockJUnit4ClassRunnerOverrideTest.java b/src/test/java/org/junit/rules/BlockJUnit4ClassRunnerOverrideTest.java
index c7047a827d84..4f85be096fda 100644
--- a/src/test/java/org/junit/rules/BlockJUnit4ClassRunnerOverrideTest.java
+++ b/src/test/java/org/junit/rules/BlockJUnit4ClassRunnerOverrideTest.java
@@ -1,6 +1,6 @@
package org.junit.rules;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.experimental.results.PrintableResult.testResult;
diff --git a/src/test/java/org/junit/rules/ClassRulesTest.java b/src/test/java/org/junit/rules/ClassRulesTest.java
index 8360322043c8..ddfb74494c97 100644
--- a/src/test/java/org/junit/rules/ClassRulesTest.java
+++ b/src/test/java/org/junit/rules/ClassRulesTest.java
@@ -3,8 +3,8 @@
*/
package org.junit.rules;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
@@ -18,7 +18,10 @@
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.MethodSorters;
+import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
/**
@@ -310,4 +313,54 @@ public void classRuleOrderingDefault() {
assertTrue(result.wasSuccessful());
assertEquals(" inner.begin outer.begin bar foo outer.end inner.end", log.toString());
}
+
+ public static class RunnerWithClassRuleAddedProgrammatically extends BlockJUnit4ClassRunner {
+ public RunnerWithClassRuleAddedProgrammatically(Class testClass) throws InitializationError {
+ super(testClass);
+ }
+
+ @Override
+ protected List
classRules() {
+ final List rules = super.classRules();
+ rules.add(new LoggingTestRule(log, "fromCode"));
+ return rules;
+ }
+ }
+
+ @RunWith(RunnerWithClassRuleAddedProgrammatically.class)
+ public static class ClassRulesModifiableListEmpty {
+ @Test
+ public void test() {
+ log.append(" test");
+ }
+ }
+
+ @Test
+ public void classRulesModifiableListEmpty() {
+ log.setLength(0);
+ Result result = JUnitCore.runClasses(ClassRulesModifiableListEmpty.class);
+ assertTrue(result.wasSuccessful());
+ assertEquals(" fromCode.begin test fromCode.end", log.toString());
+ }
+
+ @RunWith(RunnerWithClassRuleAddedProgrammatically.class)
+ public static class ClassRulesModifiableList {
+ @ClassRule
+ public static TestRule classRule() {
+ return new LoggingTestRule(log, "classRule");
+ }
+
+ @Test
+ public void test() {
+ log.append(" test");
+ }
+ }
+
+ @Test
+ public void classRulesModifiableList() {
+ log.setLength(0);
+ Result result = JUnitCore.runClasses(ClassRulesModifiableList.class);
+ assertTrue(result.wasSuccessful());
+ assertEquals(" fromCode.begin classRule.begin test classRule.end fromCode.end", log.toString());
+ }
}
diff --git a/src/test/java/org/junit/rules/ExpectedExceptionTest.java b/src/test/java/org/junit/rules/ExpectedExceptionTest.java
index 8a4bba1bef8c..f9bf3f531ac9 100644
--- a/src/test/java/org/junit/rules/ExpectedExceptionTest.java
+++ b/src/test/java/org/junit/rules/ExpectedExceptionTest.java
@@ -6,8 +6,8 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.CoreMatchers.startsWith;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsEqual.equalTo;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
import static org.junit.rules.ExpectedException.none;
diff --git a/src/test/java/org/junit/rules/MethodRulesTest.java b/src/test/java/org/junit/rules/MethodRulesTest.java
index d6efdf272c16..93eb68468d28 100644
--- a/src/test/java/org/junit/rules/MethodRulesTest.java
+++ b/src/test/java/org/junit/rules/MethodRulesTest.java
@@ -2,8 +2,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.experimental.results.PrintableResult.testResult;
diff --git a/src/test/java/org/junit/rules/RuleMemberValidatorTest.java b/src/test/java/org/junit/rules/RuleMemberValidatorTest.java
index 5fc964d725cb..01465a661230 100644
--- a/src/test/java/org/junit/rules/RuleMemberValidatorTest.java
+++ b/src/test/java/org/junit/rules/RuleMemberValidatorTest.java
@@ -76,7 +76,7 @@ static class NonPublicTestWithClassRule {
* Issue #1019
*/
@Test
- public void rejectClassRuleThatIsImplemetationOfMethodRule() {
+ public void rejectClassRuleThatIsImplementationOfMethodRule() {
TestClass target = new TestClass(TestWithClassRuleIsImplementationOfMethodRule.class);
CLASS_RULE_VALIDATOR.validate(target, errors);
assertOneErrorWithMessage("The @ClassRule 'classRule' must implement TestRule.");
diff --git a/src/test/java/org/junit/rules/StopwatchTest.java b/src/test/java/org/junit/rules/StopwatchTest.java
index 18893dd99acd..69fbcb03ec68 100644
--- a/src/test/java/org/junit/rules/StopwatchTest.java
+++ b/src/test/java/org/junit/rules/StopwatchTest.java
@@ -2,8 +2,8 @@
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.hamcrest.core.Is.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
diff --git a/src/test/java/org/junit/rules/TempFolderRuleTest.java b/src/test/java/org/junit/rules/TempFolderRuleTest.java
index f7cb5f50150d..0a82a60284cf 100644
--- a/src/test/java/org/junit/rules/TempFolderRuleTest.java
+++ b/src/test/java/org/junit/rules/TempFolderRuleTest.java
@@ -1,9 +1,9 @@
package org.junit.rules;
import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.failureCountIs;
diff --git a/src/test/java/org/junit/rules/TemporaryFolderRuleAssuredDeletionTest.java b/src/test/java/org/junit/rules/TemporaryFolderRuleAssuredDeletionTest.java
index e6184673fd3e..48cbb44e4950 100644
--- a/src/test/java/org/junit/rules/TemporaryFolderRuleAssuredDeletionTest.java
+++ b/src/test/java/org/junit/rules/TemporaryFolderRuleAssuredDeletionTest.java
@@ -1,77 +1,45 @@
package org.junit.rules;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.failureCountIs;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
-import java.io.IOException;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.results.PrintableResult;
public class TemporaryFolderRuleAssuredDeletionTest {
- private static class StubTemporaryFolder extends TemporaryFolder {
- private StubTemporaryFolder(Builder builder) {
- super(builder);
- }
-
- /**
- * Don't need to create as we are overriding deletion.
- */
- @Override
- public void create() throws IOException {
- }
-
- /**
- * Simulates failure to clean-up temporary folder.
- */
- @Override
- protected boolean tryDelete() {
- return false;
- }
-
- public static Builder builder() {
- return new TemporaryFolder.Builder() {
- @Override
- public TemporaryFolder build() {
- return new StubTemporaryFolder(this);
- }
- };
- }
- }
+ public static class TestClass {
+ static TemporaryFolder injectedRule;
- public static class HasTempFolderWithAssuredDeletion {
- @Rule public TemporaryFolder folder = StubTemporaryFolder.builder()
- .assureDeletion()
- .build();
+ @Rule
+ public TemporaryFolder folder = injectedRule;
@Test
- public void alwaysPasses() {
+ public void alwaysPassesButDeletesRootFolder() {
+ //we delete the folder in the test so that it cannot be deleted by
+ //the rule
+ folder.getRoot().delete();
}
}
@Test
- public void testStrictVerificationFailure() {
- PrintableResult result = testResult(HasTempFolderWithAssuredDeletion.class);
+ public void testFailsWhenCreatedFolderCannotBeDeletedButDeletionIsAssured() {
+ TestClass.injectedRule = TemporaryFolder.builder()
+ .assureDeletion()
+ .build();
+ PrintableResult result = testResult(TestClass.class);
assertThat(result, failureCountIs(1));
assertThat(result.toString(), containsString("Unable to clean up temporary folder"));
}
- public static class HasTempFolderWithoutAssuredDeletion {
- @Rule public TemporaryFolder folder = StubTemporaryFolder.builder().build();
-
- @Test
- public void alwaysPasses() {
- }
- }
-
@Test
- public void testStrictVerificationSuccess() {
- PrintableResult result = testResult(HasTempFolderWithoutAssuredDeletion.class);
+ public void byDefaultTestDoesNotFailWhenCreatedFolderCannotBeDeleted() {
+ TestClass.injectedRule = new TemporaryFolder();
+ PrintableResult result = testResult(TestClass.class);
assertThat(result, isSuccessful());
}
}
diff --git a/src/test/java/org/junit/rules/TemporaryFolderUsageTest.java b/src/test/java/org/junit/rules/TemporaryFolderUsageTest.java
index 55f7bea79510..584a29603f64 100644
--- a/src/test/java/org/junit/rules/TemporaryFolderUsageTest.java
+++ b/src/test/java/org/junit/rules/TemporaryFolderUsageTest.java
@@ -3,8 +3,9 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
import java.io.File;
import java.io.IOException;
@@ -89,6 +90,17 @@ public void newFolderWithGivenFolderThrowsIOExceptionIfFileExists() throws IOExc
File file = new File(tempFolder.getRoot(), "level1");
assertTrue("Could not create" + file, file.createNewFile());
+ thrown.expect(IOException.class);
+ thrown.expectMessage("a file with the path 'level1' exists");
+ tempFolder.newFolder("level1");
+ }
+
+ @Test
+ public void newFolderWithGivenFolderThrowsIOExceptionWhenFolderCannotBeCreated() throws IOException {
+ tempFolder.create();
+ assumeTrue("Could not make folder " + tempFolder.getRoot() + " read only.",
+ tempFolder.getRoot().setReadOnly());
+
thrown.expect(IOException.class);
thrown.expectMessage("could not create a folder with the path 'level1'");
tempFolder.newFolder("level1");
@@ -111,7 +123,7 @@ public void newFolderWithPathStartingWithFileSeparatorThrowsIOException()
}
@Test
- public void newFolderWithPathContainingFileSeparaterCreatesDirectories()
+ public void newFolderWithPathContainingFileSeparatorCreatesDirectories()
throws IOException {
tempFolder.create();
tempFolder.newFolder("temp1" + File.separator + "temp2");
diff --git a/src/test/java/org/junit/rules/TestRuleTest.java b/src/test/java/org/junit/rules/TestRuleTest.java
index 55fbb85156ae..23d4bfbc8ff4 100644
--- a/src/test/java/org/junit/rules/TestRuleTest.java
+++ b/src/test/java/org/junit/rules/TestRuleTest.java
@@ -2,8 +2,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.experimental.results.PrintableResult.testResult;
diff --git a/src/test/java/org/junit/rules/TestWatchmanTest.java b/src/test/java/org/junit/rules/TestWatchmanTest.java
index 5fcb02b780e2..b7b76be0180d 100644
--- a/src/test/java/org/junit/rules/TestWatchmanTest.java
+++ b/src/test/java/org/junit/rules/TestWatchmanTest.java
@@ -2,7 +2,7 @@
import static junit.framework.Assert.fail;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.junit.runner.JUnitCore.runClasses;
import org.junit.BeforeClass;
diff --git a/src/test/java/org/junit/rules/TimeoutRuleTest.java b/src/test/java/org/junit/rules/TimeoutRuleTest.java
index e3b2041af526..6c0e349bd507 100644
--- a/src/test/java/org/junit/rules/TimeoutRuleTest.java
+++ b/src/test/java/org/junit/rules/TimeoutRuleTest.java
@@ -1,8 +1,8 @@
package org.junit.rules;
import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import java.io.File;
import java.io.IOException;
diff --git a/src/test/java/org/junit/rules/VerifierRuleTest.java b/src/test/java/org/junit/rules/VerifierRuleTest.java
index 8f92bcb3427f..4a09bc78fb04 100644
--- a/src/test/java/org/junit/rules/VerifierRuleTest.java
+++ b/src/test/java/org/junit/rules/VerifierRuleTest.java
@@ -1,7 +1,7 @@
package org.junit.rules;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
diff --git a/src/test/java/org/junit/runner/AllRunnerTests.java b/src/test/java/org/junit/runner/AllRunnerTests.java
index 3f4671630f6d..3334b40d0a0f 100644
--- a/src/test/java/org/junit/runner/AllRunnerTests.java
+++ b/src/test/java/org/junit/runner/AllRunnerTests.java
@@ -10,6 +10,7 @@
AllNotificationTests.class,
FilterFactoriesTest.class,
FilterOptionIntegrationTest.class,
+ OrderWithValidatorTest.class,
JUnitCommandLineParseResultTest.class,
JUnitCoreTest.class, RequestTest.class
})
diff --git a/src/test/java/org/junit/runner/OrderWithValidatorTest.java b/src/test/java/org/junit/runner/OrderWithValidatorTest.java
new file mode 100644
index 000000000000..cfa3c5e13462
--- /dev/null
+++ b/src/test/java/org/junit/runner/OrderWithValidatorTest.java
@@ -0,0 +1,50 @@
+package org.junit.runner;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.List;
+
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runner.manipulation.Alphanumeric;
+import org.junit.runners.JUnit4;
+import org.junit.runners.MethodSorters;
+import org.junit.runners.model.TestClass;
+
+public class OrderWithValidatorTest {
+ private final OrderWithValidator validator = new OrderWithValidator();
+
+ @RunWith(JUnit4.class)
+ @OrderWith(Alphanumeric.class)
+ public static class TestWithNoValidationErrors {
+ @Test
+ public void passes() {}
+ }
+
+ @RunWith(JUnit4.class)
+ @OrderWith(Alphanumeric.class)
+ @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+ public static class TestAnnotatedWithFixMethodOrder {
+ @Test
+ public void passes() {}
+ }
+
+ @Test
+ public void noErrorIsAddedForTestWithoutValdationErrors() {
+ List errors = validator.validateAnnotatedClass(
+ new TestClass(TestWithNoValidationErrors.class));
+
+ assertThat(errors.size(), is(0));
+ }
+
+ @Test
+ public void errorIsAddedWhenTestAnnotatedWithFixMethodOrder() {
+ List errors = validator.validateAnnotatedClass(
+ new TestClass(TestAnnotatedWithFixMethodOrder.class));
+
+ assertThat(errors.size(), is(1));
+ Exception exception = errors.get(0);
+ assertThat(exception.getMessage(), is("@FixMethodOrder cannot be combined with @OrderWith"));
+ }
+}
diff --git a/src/test/java/org/junit/runner/notification/ConcurrentRunNotifierTest.java b/src/test/java/org/junit/runner/notification/ConcurrentRunNotifierTest.java
index 3406ed91150f..b7386e3d3635 100644
--- a/src/test/java/org/junit/runner/notification/ConcurrentRunNotifierTest.java
+++ b/src/test/java/org/junit/runner/notification/ConcurrentRunNotifierTest.java
@@ -13,8 +13,8 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
/**
diff --git a/src/test/java/org/junit/runner/notification/RunNotifierTest.java b/src/test/java/org/junit/runner/notification/RunNotifierTest.java
index 531754f24e99..c3a4a8855642 100644
--- a/src/test/java/org/junit/runner/notification/RunNotifierTest.java
+++ b/src/test/java/org/junit/runner/notification/RunNotifierTest.java
@@ -2,9 +2,9 @@
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.core.Is.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
import java.util.concurrent.atomic.AtomicInteger;
diff --git a/src/test/java/org/junit/runners/model/FrameworkFieldTest.java b/src/test/java/org/junit/runners/model/FrameworkFieldTest.java
index 1d185a548e72..55ba75e181c1 100644
--- a/src/test/java/org/junit/runners/model/FrameworkFieldTest.java
+++ b/src/test/java/org/junit/runners/model/FrameworkFieldTest.java
@@ -2,7 +2,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.rules.ExpectedException.none;
diff --git a/src/test/java/org/junit/runners/model/FrameworkMethodTest.java b/src/test/java/org/junit/runners/model/FrameworkMethodTest.java
index 9927d1908676..b97df8221a78 100644
--- a/src/test/java/org/junit/runners/model/FrameworkMethodTest.java
+++ b/src/test/java/org/junit/runners/model/FrameworkMethodTest.java
@@ -2,7 +2,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.rules.ExpectedException.none;
diff --git a/src/test/java/org/junit/runners/model/TestClassTest.java b/src/test/java/org/junit/runners/model/TestClassTest.java
index 213da10498b3..6b5cb2857a08 100644
--- a/src/test/java/org/junit/runners/model/TestClassTest.java
+++ b/src/test/java/org/junit/runners/model/TestClassTest.java
@@ -46,9 +46,9 @@ public static class SubclassWithField extends SuperclassWithField {
}
@Test
- public void fieldsOnSubclassesDoNotShadowSuperclasses() {
+ public void fieldsOnSubclassesShadowSuperclasses() {
assertThat(new TestClass(SubclassWithField.class).getAnnotatedFields(
- Rule.class).size(), is(2));
+ Rule.class).size(), is(1));
}
public static class OuterClass {
diff --git a/src/test/java/org/junit/runners/parameterized/ParameterizedNamesTest.java b/src/test/java/org/junit/runners/parameterized/ParameterizedNamesTest.java
index 25dedfebda9b..e04fb7610eab 100644
--- a/src/test/java/org/junit/runners/parameterized/ParameterizedNamesTest.java
+++ b/src/test/java/org/junit/runners/parameterized/ParameterizedNamesTest.java
@@ -17,9 +17,9 @@
*/
public class ParameterizedNamesTest {
@RunWith(Parameterized.class)
- public static class ParametrizedWithSpecialCharsInName {
+ public static class ParameterizedWithSpecialCharsInName {
- public ParametrizedWithSpecialCharsInName(String s) {
+ public ParameterizedWithSpecialCharsInName(String s) {
}
@Parameterized.Parameters(name = "{0}")
@@ -41,7 +41,7 @@ public void test() {
@Test
public void parameterizedTestsWithSpecialCharsInName() {
- Request request = Request.aClass(ParametrizedWithSpecialCharsInName.class);
+ Request request = Request.aClass(ParameterizedWithSpecialCharsInName.class);
for (Description parent : request.getRunner().getDescription().getChildren()) {
for (Description description : parent.getChildren()) {
assertEquals("test" + parent.getDisplayName(), description.getMethodName());
diff --git a/src/test/java/org/junit/tests/ObjectContractTest.java b/src/test/java/org/junit/tests/ObjectContractTest.java
index 27172f93cb93..541a25b94a59 100644
--- a/src/test/java/org/junit/tests/ObjectContractTest.java
+++ b/src/test/java/org/junit/tests/ObjectContractTest.java
@@ -1,7 +1,7 @@
package org.junit.tests;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeNotNull;
import static org.junit.Assume.assumeThat;
diff --git a/src/test/java/org/junit/tests/assertion/AssertionTest.java b/src/test/java/org/junit/tests/assertion/AssertionTest.java
index d0c3bdfddc59..22907e07c56f 100644
--- a/src/test/java/org/junit/tests/assertion/AssertionTest.java
+++ b/src/test/java/org/junit/tests/assertion/AssertionTest.java
@@ -782,7 +782,7 @@ public void sameObjectIsNotEqual() {
}
@Test
- public void objectsWithDiferentReferencesAreNotEqual() {
+ public void objectsWithDifferentReferencesAreNotEqual() {
assertNotEquals(new Object(), new Object());
}
diff --git a/src/test/java/org/junit/tests/deprecated/JUnit4ClassRunnerTest.java b/src/test/java/org/junit/tests/deprecated/JUnit4ClassRunnerTest.java
index 43983ba97637..c0c081d49279 100644
--- a/src/test/java/org/junit/tests/deprecated/JUnit4ClassRunnerTest.java
+++ b/src/test/java/org/junit/tests/deprecated/JUnit4ClassRunnerTest.java
@@ -1,7 +1,7 @@
package org.junit.tests.deprecated;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;
import org.junit.Test;
diff --git a/src/test/java/org/junit/tests/experimental/AssumptionTest.java b/src/test/java/org/junit/tests/experimental/AssumptionTest.java
index 52cd2d844cdc..45e94b026edc 100644
--- a/src/test/java/org/junit/tests/experimental/AssumptionTest.java
+++ b/src/test/java/org/junit/tests/experimental/AssumptionTest.java
@@ -2,9 +2,9 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNoException;
@@ -159,7 +159,17 @@ public void assumeTrueWorks() {
Assume.assumeTrue(false);
fail("should throw AssumptionViolatedException");
} catch (AssumptionViolatedException e) {
- // expected
+ assertEquals("got: , expected: is ", e.getMessage());
+ }
+ }
+
+ @Test
+ public void assumeFalseWorks() {
+ try {
+ Assume.assumeFalse(true);
+ fail("should throw AssumptionViolatedException");
+ } catch (AssumptionViolatedException e) {
+ assertEquals("got: , expected: is ", e.getMessage());
}
}
diff --git a/src/test/java/org/junit/tests/experimental/MatcherTest.java b/src/test/java/org/junit/tests/experimental/MatcherTest.java
index 6a1eb42b7c17..10f13a4eafaf 100644
--- a/src/test/java/org/junit/tests/experimental/MatcherTest.java
+++ b/src/test/java/org/junit/tests/experimental/MatcherTest.java
@@ -1,7 +1,7 @@
package org.junit.tests.experimental;
import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeThat;
import static org.junit.experimental.results.ResultMatchers.hasFailureContaining;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;
diff --git a/src/test/java/org/junit/tests/experimental/max/DescriptionTest.java b/src/test/java/org/junit/tests/experimental/max/DescriptionTest.java
index 4d2396ad5cbf..607bb8157d95 100644
--- a/src/test/java/org/junit/tests/experimental/max/DescriptionTest.java
+++ b/src/test/java/org/junit/tests/experimental/max/DescriptionTest.java
@@ -2,9 +2,9 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
import java.lang.annotation.Annotation;
import java.net.URL;
diff --git a/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java b/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java
index 9c8008012270..d1bde455cac9 100644
--- a/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java
+++ b/src/test/java/org/junit/tests/experimental/max/MaxStarterTest.java
@@ -2,8 +2,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
diff --git a/src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java b/src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java
index 1752c0df1be1..86a2646af84f 100644
--- a/src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java
+++ b/src/test/java/org/junit/tests/experimental/parallel/ParallelClassTest.java
@@ -2,8 +2,8 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.CountDownLatch;
diff --git a/src/test/java/org/junit/tests/experimental/parallel/ParallelMethodTest.java b/src/test/java/org/junit/tests/experimental/parallel/ParallelMethodTest.java
index 053e2f5a4eb4..fd4b4de99640 100644
--- a/src/test/java/org/junit/tests/experimental/parallel/ParallelMethodTest.java
+++ b/src/test/java/org/junit/tests/experimental/parallel/ParallelMethodTest.java
@@ -2,8 +2,8 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import java.util.concurrent.CountDownLatch;
diff --git a/src/test/java/org/junit/tests/experimental/results/PrintableResultTest.java b/src/test/java/org/junit/tests/experimental/results/PrintableResultTest.java
index ba9ae3d5f141..3a6e366b53b5 100644
--- a/src/test/java/org/junit/tests/experimental/results/PrintableResultTest.java
+++ b/src/test/java/org/junit/tests/experimental/results/PrintableResultTest.java
@@ -3,7 +3,7 @@
import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Arrays;
diff --git a/src/test/java/org/junit/tests/experimental/results/ResultMatchersTest.java b/src/test/java/org/junit/tests/experimental/results/ResultMatchersTest.java
index 4c121b965c93..768bfbab64c0 100644
--- a/src/test/java/org/junit/tests/experimental/results/ResultMatchersTest.java
+++ b/src/test/java/org/junit/tests/experimental/results/ResultMatchersTest.java
@@ -12,7 +12,7 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
public class ResultMatchersTest {
diff --git a/src/test/java/org/junit/tests/experimental/theories/ParameterSignatureTest.java b/src/test/java/org/junit/tests/experimental/theories/ParameterSignatureTest.java
index edfcdd1c841b..cf786ba6b73b 100644
--- a/src/test/java/org/junit/tests/experimental/theories/ParameterSignatureTest.java
+++ b/src/test/java/org/junit/tests/experimental/theories/ParameterSignatureTest.java
@@ -1,8 +1,8 @@
package org.junit.tests.experimental.theories;
import static org.hamcrest.CoreMatchers.isA;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
diff --git a/src/test/java/org/junit/tests/experimental/theories/TestedOnSupplierTest.java b/src/test/java/org/junit/tests/experimental/theories/TestedOnSupplierTest.java
index 90fcd461dd86..137617121b2d 100644
--- a/src/test/java/org/junit/tests/experimental/theories/TestedOnSupplierTest.java
+++ b/src/test/java/org/junit/tests/experimental/theories/TestedOnSupplierTest.java
@@ -1,7 +1,7 @@
package org.junit.tests.experimental.theories;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.lang.reflect.Method;
import java.util.List;
diff --git a/src/test/java/org/junit/tests/experimental/theories/internal/AllMembersSupplierTest.java b/src/test/java/org/junit/tests/experimental/theories/internal/AllMembersSupplierTest.java
index a3ee3635bd48..64e77b1e668a 100644
--- a/src/test/java/org/junit/tests/experimental/theories/internal/AllMembersSupplierTest.java
+++ b/src/test/java/org/junit/tests/experimental/theories/internal/AllMembersSupplierTest.java
@@ -1,9 +1,9 @@
package org.junit.tests.experimental.theories.internal;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.tests.experimental.theories.TheoryTestUtils.potentialAssignments;
import java.util.Arrays;
diff --git a/src/test/java/org/junit/tests/experimental/theories/internal/ParameterizedAssertionErrorTest.java b/src/test/java/org/junit/tests/experimental/theories/internal/ParameterizedAssertionErrorTest.java
index 2d42d992c3c2..285ebf522379 100644
--- a/src/test/java/org/junit/tests/experimental/theories/internal/ParameterizedAssertionErrorTest.java
+++ b/src/test/java/org/junit/tests/experimental/theories/internal/ParameterizedAssertionErrorTest.java
@@ -3,7 +3,7 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertFalse;
import static org.junit.Assume.assumeThat;
diff --git a/src/test/java/org/junit/tests/experimental/theories/internal/SpecificDataPointsSupplierTest.java b/src/test/java/org/junit/tests/experimental/theories/internal/SpecificDataPointsSupplierTest.java
index 3ccf902c9bcf..1ba6136a2150 100644
--- a/src/test/java/org/junit/tests/experimental/theories/internal/SpecificDataPointsSupplierTest.java
+++ b/src/test/java/org/junit/tests/experimental/theories/internal/SpecificDataPointsSupplierTest.java
@@ -2,8 +2,8 @@
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import java.util.ArrayList;
import java.util.List;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/FailingDataPointMethods.java b/src/test/java/org/junit/tests/experimental/theories/runner/FailingDataPointMethods.java
index 5abc0ea480fb..f69e5023686c 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/FailingDataPointMethods.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/FailingDataPointMethods.java
@@ -1,7 +1,7 @@
package org.junit.tests.experimental.theories.runner;
import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
import org.junit.Test;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/SuccessfulWithDataPointFields.java b/src/test/java/org/junit/tests/experimental/theories/runner/SuccessfulWithDataPointFields.java
index 41d766a7e9ab..2b5d587be21c 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/SuccessfulWithDataPointFields.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/SuccessfulWithDataPointFields.java
@@ -1,8 +1,8 @@
package org.junit.tests.experimental.theories.runner;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/TheoriesPerformanceTest.java b/src/test/java/org/junit/tests/experimental/theories/runner/TheoriesPerformanceTest.java
index 8136493a90a9..9275524777d1 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/TheoriesPerformanceTest.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/TheoriesPerformanceTest.java
@@ -1,6 +1,6 @@
package org.junit.tests.experimental.theories.runner;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeTrue;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/TypeMatchingBetweenMultiDataPointsMethod.java b/src/test/java/org/junit/tests/experimental/theories/runner/TypeMatchingBetweenMultiDataPointsMethod.java
index 8232a902790c..4b7e87847f4c 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/TypeMatchingBetweenMultiDataPointsMethod.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/TypeMatchingBetweenMultiDataPointsMethod.java
@@ -1,6 +1,6 @@
package org.junit.tests.experimental.theories.runner;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/UnsuccessfulWithDataPointFields.java b/src/test/java/org/junit/tests/experimental/theories/runner/UnsuccessfulWithDataPointFields.java
index 3298ef4a0fda..57dec2d396ad 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/UnsuccessfulWithDataPointFields.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/UnsuccessfulWithDataPointFields.java
@@ -2,7 +2,7 @@
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.hasFailureContaining;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WhenNoParametersMatch.java b/src/test/java/org/junit/tests/experimental/theories/runner/WhenNoParametersMatch.java
index 17afed98029b..a8e3a847dc89 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WhenNoParametersMatch.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WhenNoParametersMatch.java
@@ -3,7 +3,7 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assume.assumeThat;
import static org.junit.experimental.results.PrintableResult.testResult;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
index c814508de897..f2b27531da55 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithDataPointMethod.java
@@ -5,7 +5,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
import static org.junit.tests.experimental.theories.TheoryTestUtils.potentialAssignments;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WithExtendedParameterSources.java b/src/test/java/org/junit/tests/experimental/theories/runner/WithExtendedParameterSources.java
index 29ffea0608ce..c08839f76d28 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithExtendedParameterSources.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithExtendedParameterSources.java
@@ -3,7 +3,7 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WithNamedDataPoints.java b/src/test/java/org/junit/tests/experimental/theories/runner/WithNamedDataPoints.java
index 249ef1041c4b..8383a47107be 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithNamedDataPoints.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithNamedDataPoints.java
@@ -1,8 +1,8 @@
package org.junit.tests.experimental.theories.runner;
import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.tests.experimental.theories.TheoryTestUtils.potentialAssignments;
import java.util.List;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WithOnlyTestAnnotations.java b/src/test/java/org/junit/tests/experimental/theories/runner/WithOnlyTestAnnotations.java
index 2dea231a2b88..17b2665c8909 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithOnlyTestAnnotations.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithOnlyTestAnnotations.java
@@ -2,8 +2,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.failureCountIs;
import static org.junit.experimental.results.ResultMatchers.isSuccessful;
diff --git a/src/test/java/org/junit/tests/experimental/theories/runner/WithUnresolvedGenericTypeVariablesOnTheoryParms.java b/src/test/java/org/junit/tests/experimental/theories/runner/WithUnresolvedGenericTypeVariablesOnTheoryParms.java
index 50ac09c16b9d..5d466998eced 100644
--- a/src/test/java/org/junit/tests/experimental/theories/runner/WithUnresolvedGenericTypeVariablesOnTheoryParms.java
+++ b/src/test/java/org/junit/tests/experimental/theories/runner/WithUnresolvedGenericTypeVariablesOnTheoryParms.java
@@ -1,6 +1,6 @@
package org.junit.tests.experimental.theories.runner;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.failureCountIs;
import static org.junit.experimental.results.ResultMatchers.hasFailureContaining;
diff --git a/src/test/java/org/junit/tests/junit3compatibility/AllTestsTest.java b/src/test/java/org/junit/tests/junit3compatibility/AllTestsTest.java
index 96fad3d3ade5..99468128907a 100644
--- a/src/test/java/org/junit/tests/junit3compatibility/AllTestsTest.java
+++ b/src/test/java/org/junit/tests/junit3compatibility/AllTestsTest.java
@@ -1,8 +1,8 @@
package org.junit.tests.junit3compatibility;
import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import junit.framework.JUnit4TestAdapter;
diff --git a/src/test/java/org/junit/tests/listening/TextListenerTest.java b/src/test/java/org/junit/tests/listening/TextListenerTest.java
index c266d0c8c9ff..0cb1aff10a45 100644
--- a/src/test/java/org/junit/tests/listening/TextListenerTest.java
+++ b/src/test/java/org/junit/tests/listening/TextListenerTest.java
@@ -2,7 +2,7 @@
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.core.StringContains.containsString;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
diff --git a/src/test/java/org/junit/tests/manipulation/AllManipulationTests.java b/src/test/java/org/junit/tests/manipulation/AllManipulationTests.java
index d7532152b490..5989e1be7e51 100644
--- a/src/test/java/org/junit/tests/manipulation/AllManipulationTests.java
+++ b/src/test/java/org/junit/tests/manipulation/AllManipulationTests.java
@@ -8,6 +8,8 @@
@SuiteClasses({
FilterableTest.class,
FilterTest.class,
+ OrderableTest.class,
+ OrderWithTest.class,
SingleMethodTest.class,
SortableTest.class
})
diff --git a/src/test/java/org/junit/tests/manipulation/AlphanumericOrdering.java b/src/test/java/org/junit/tests/manipulation/AlphanumericOrdering.java
new file mode 100644
index 000000000000..ff1a513e9119
--- /dev/null
+++ b/src/test/java/org/junit/tests/manipulation/AlphanumericOrdering.java
@@ -0,0 +1,15 @@
+package org.junit.tests.manipulation;
+
+import org.junit.runner.manipulation.Ordering;
+
+/**
+ * An ordering that orders tests alphanumerically by test name.
+ */
+public final class AlphanumericOrdering implements Ordering.Factory {
+ public static final ComparatorBasedOrdering INSTANCE = new ComparatorBasedOrdering(
+ Comparators.alphanumeric());
+
+ public Ordering create(Ordering.Context context) {
+ return INSTANCE;
+ }
+}
diff --git a/src/test/java/org/junit/tests/manipulation/ComparatorBasedOrdering.java b/src/test/java/org/junit/tests/manipulation/ComparatorBasedOrdering.java
new file mode 100644
index 000000000000..6eff4a94dda9
--- /dev/null
+++ b/src/test/java/org/junit/tests/manipulation/ComparatorBasedOrdering.java
@@ -0,0 +1,28 @@
+package org.junit.tests.manipulation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Ordering;
+
+/**
+ * An ordering that internally uses a {@link Comparator}.
+ */
+class ComparatorBasedOrdering extends Ordering {
+ private final Comparator comparator;
+
+ protected ComparatorBasedOrdering(Comparator comparator) {
+ this.comparator = comparator;
+ }
+
+ @Override
+ protected List orderItems(Collection descriptions) {
+ List ordered = new ArrayList(descriptions);
+ Collections.sort(ordered, comparator);
+ return ordered;
+ }
+}
diff --git a/src/test/java/org/junit/tests/manipulation/Comparators.java b/src/test/java/org/junit/tests/manipulation/Comparators.java
new file mode 100644
index 000000000000..8c61e89b7b26
--- /dev/null
+++ b/src/test/java/org/junit/tests/manipulation/Comparators.java
@@ -0,0 +1,19 @@
+package org.junit.tests.manipulation;
+
+import java.util.Comparator;
+
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Alphanumeric;
+
+/**
+ * Factory and utility methods for creating {@link Comparator} instances for tests.
+ */
+class Comparators {
+ private static final Comparator ALPHANUMERIC = new Alphanumeric();
+
+ private Comparators() {}
+
+ public static Comparator alphanumeric() {
+ return ALPHANUMERIC;
+ }
+}
diff --git a/src/test/java/org/junit/tests/manipulation/OrderWithTest.java b/src/test/java/org/junit/tests/manipulation/OrderWithTest.java
new file mode 100644
index 000000000000..bfefeb35022b
--- /dev/null
+++ b/src/test/java/org/junit/tests/manipulation/OrderWithTest.java
@@ -0,0 +1,268 @@
+package org.junit.tests.manipulation;
+
+import static org.junit.Assert.assertEquals;
+import junit.framework.JUnit4TestAdapter;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.OrderWith;
+import org.junit.runner.Request;
+import org.junit.runner.RunWith;
+import org.junit.runner.Runner;
+import org.junit.runner.manipulation.Alphanumeric;
+import org.junit.runner.notification.RunNotifier;
+
+@RunWith(Enclosed.class)
+public class OrderWithTest {
+
+ public static class TestClassRunnerIsOrderableViaOrderWith {
+ private static String log = "";
+
+ public static class Unordered {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+ }
+
+ @OrderWith(AlphanumericOrdering.class)
+ public static class OrderedAlphanumerically extends Unordered {
+ }
+
+ @OrderWith(ReverseAlphanumericOrdering.class)
+ public static class OrderedReverseAlphanumerically extends Unordered {
+ }
+
+ @Before
+ public void resetLog() {
+ log = "";
+ }
+
+ @Test
+ public void orderingForwardWorksOnTestClassRunner() {
+ Request forward = Request.aClass(OrderedAlphanumerically.class);
+
+ new JUnitCore().run(forward);
+ assertEquals("abc", log);
+ }
+
+ @Test
+ public void orderingBackwardWorksOnTestClassRunner() {
+ Request backward = Request.aClass(OrderedReverseAlphanumerically.class);
+
+ new JUnitCore().run(backward);
+ assertEquals("cba", log);
+ }
+
+ @RunWith(Enclosed.class)
+ public static class UnorderedSuite {
+ public static class A {
+ @Test
+ public void a() {
+ log += "Aa";
+ }
+
+ @Test
+ public void b() {
+ log += "Ab";
+ }
+
+ @Test
+ public void c() {
+ log += "Ac";
+ }
+ }
+
+ public static class B {
+ @Test
+ public void a() {
+ log += "Ba";
+ }
+
+ @Test
+ public void b() {
+ log += "Bb";
+ }
+
+ @Test
+ public void c() {
+ log += "Bc";
+ }
+ }
+ }
+
+ @OrderWith(AlphanumericOrdering.class)
+ public static class SuiteOrderedAlphanumerically extends UnorderedSuite {
+ }
+
+ @OrderWith(ReverseAlphanumericOrdering.class)
+ public static class SuiteOrderedReverseAlphanumerically extends UnorderedSuite {
+ }
+
+ @Test
+ public void orderingForwardWorksOnSuite() {
+ Request forward = Request.aClass(SuiteOrderedAlphanumerically.class);
+
+ new JUnitCore().run(forward);
+ assertEquals("AaAbAcBaBbBc", log);
+ }
+
+ @Test
+ public void orderingBackwardWorksOnSuite() {
+ Request backward = Request.aClass(SuiteOrderedReverseAlphanumerically.class);
+
+ new JUnitCore().run(backward);
+ assertEquals("BcBbBaAcAbAa", log);
+ }
+ }
+
+ public static class TestClassRunnerIsSortableViaOrderWith {
+ private static String log = "";
+
+ public static class Unordered {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+ }
+
+ @Before
+ public void resetLog() {
+ log = "";
+ }
+
+ @OrderWith(Alphanumeric.class)
+ public static class SortedAlphanumerically extends Unordered {
+ }
+
+ @OrderWith(ReverseAlphanumericSorter.class)
+ public static class SortedReverseAlphanumerically extends Unordered {
+ }
+
+ @Test
+ public void sortingForwardWorksOnTestClassRunner() {
+ Request forward = Request.aClass(SortedAlphanumerically.class);
+
+ new JUnitCore().run(forward);
+ assertEquals("abc", log);
+ }
+
+ @Test
+ public void sortingBackwardWorksOnTestClassRunner() {
+ Request backward = Request.aClass(SortedReverseAlphanumerically.class);
+
+ new JUnitCore().run(backward);
+ assertEquals("cba", log);
+ }
+ }
+
+ public static class TestClassRunnerIsOrderableWithSuiteMethod {
+ private static String log = "";
+
+ public static class Unordered {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+ }
+
+ @OrderWith(AlphanumericOrdering.class)
+ public static class OrderedAlphanumerically extends Unordered {
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(OrderedAlphanumerically.class);
+ }
+ }
+
+ @OrderWith(ReverseAlphanumericOrdering.class)
+ public static class OrderedReverseAlphanumerically extends Unordered {
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(OrderedReverseAlphanumerically.class);
+ }
+ }
+
+ @Before
+ public void resetLog() {
+ log = "";
+ }
+
+ @Test
+ public void orderingForwardWorksOnTestClassRunner() {
+ Request forward = Request.aClass(OrderedAlphanumerically.class);
+
+ new JUnitCore().run(forward);
+ assertEquals("abc", log);
+ }
+
+ @Test
+ public void orderingBackwardWorksOnTestClassRunner() {
+ Request backward = Request.aClass(OrderedReverseAlphanumerically.class);
+
+ new JUnitCore().run(backward);
+ assertEquals("cba", log);
+ }
+ }
+
+ public static class UnOrderableRunnersAreHandledWithoutCrashing {
+ public static class UnOrderableRunner extends Runner {
+ public UnOrderableRunner(Class> klass) {
+ }
+
+ @Override
+ public Description getDescription() {
+ return Description.EMPTY;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ }
+ }
+
+ @RunWith(UnOrderableRunner.class)
+ public static class UnOrderable {
+ @Test
+ public void a() {
+ }
+ }
+
+ @Test
+ public void unOrderablesAreHandledWithoutCrashing() {
+ Request unordered = Request.aClass(UnOrderable.class).orderWith(
+ AlphanumericOrdering.INSTANCE);
+ new JUnitCore().run(unordered);
+ }
+ }
+}
diff --git a/src/test/java/org/junit/tests/manipulation/OrderableTest.java b/src/test/java/org/junit/tests/manipulation/OrderableTest.java
new file mode 100644
index 000000000000..4adfac2250fb
--- /dev/null
+++ b/src/test/java/org/junit/tests/manipulation/OrderableTest.java
@@ -0,0 +1,301 @@
+package org.junit.tests.manipulation;
+
+import static org.junit.Assert.assertEquals;
+import junit.framework.JUnit4TestAdapter;
+import org.junit.Before;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.RunWith;
+import org.junit.runner.Runner;
+import org.junit.runner.manipulation.Orderer;
+import org.junit.runner.manipulation.InvalidOrderingException;
+import org.junit.runner.manipulation.Orderable;
+import org.junit.runner.manipulation.Sorter;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.MethodSorters;
+
+@RunWith(Enclosed.class)
+public class OrderableTest {
+
+ public static class TestClassRunnerIsOrderable {
+ private static String log = "";
+
+ public static class OrderMe {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+ }
+
+ @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+ public static class DoNotOrderMe {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+ }
+
+ @Before
+ public void resetLog() {
+ log = "";
+ }
+
+ @Test
+ public void orderingForwardWorksOnTestClassRunner() {
+ Request forward = Request.aClass(OrderMe.class).orderWith(
+ AlphanumericOrdering.INSTANCE);
+
+ new JUnitCore().run(forward);
+ assertEquals("abc", log);
+ }
+
+ @Test
+ public void orderingBackwardWorksOnTestClassRunner() {
+ Request backward = Request.aClass(OrderMe.class).orderWith(
+ new ReverseAlphanumericOrdering());
+
+ new JUnitCore().run(backward);
+ assertEquals("cba", log);
+ }
+
+ @Test
+ public void orderingBackwardDoesNothingOnTestClassRunnerWithFixMethodOrder() {
+ Request backward = Request.aClass(DoNotOrderMe.class).orderWith(
+ new ReverseAlphanumericOrdering());
+
+ new JUnitCore().run(backward);
+ assertEquals("abc", log);
+ }
+
+ @RunWith(Enclosed.class)
+ public static class Enclosing {
+ public static class A {
+ @Test
+ public void a() {
+ log += "Aa";
+ }
+
+ @Test
+ public void b() {
+ log += "Ab";
+ }
+
+ @Test
+ public void c() {
+ log += "Ac";
+ }
+ }
+
+ public static class B {
+ @Test
+ public void a() {
+ log += "Ba";
+ }
+
+ @Test
+ public void b() {
+ log += "Bb";
+ }
+
+ @Test
+ public void c() {
+ log += "Bc";
+ }
+ }
+ }
+
+ @Test
+ public void orderingForwardWorksOnSuite() {
+ Request forward = Request.aClass(Enclosing.class).orderWith(
+ AlphanumericOrdering.INSTANCE);
+
+ new JUnitCore().run(forward);
+ assertEquals("AaAbAcBaBbBc", log);
+ }
+
+ @Test
+ public void orderingBackwardWorksOnSuite() {
+ Request backward = Request.aClass(Enclosing.class).orderWith(
+ new ReverseAlphanumericOrdering());
+
+ new JUnitCore().run(backward);
+ assertEquals("BcBbBaAcAbAa", log);
+ }
+ }
+
+ public static class TestOrderableClassRunnerIsSortable {
+ private static String log = "";
+
+ /**
+ * A Runner that implements {@link Orderable}.
+ */
+ public static class OrderableRunner extends Runner implements Orderable {
+ private final BlockJUnit4ClassRunner delegate;
+
+ public OrderableRunner(Class> klass) throws Throwable {
+ delegate = new BlockJUnit4ClassRunner(klass);
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ delegate.run(notifier);
+ }
+
+ @Override
+ public Description getDescription() {
+ return delegate.getDescription();
+ }
+
+ public void order(Orderer orderer) throws InvalidOrderingException {
+ delegate.order(orderer);
+ }
+
+ public void sort(Sorter sorter) {
+ delegate.sort(sorter);
+ }
+ }
+
+ @RunWith(OrderableRunner.class)
+ public static class OrderMe {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+ }
+
+ @Before
+ public void resetLog() {
+ log = "";
+ }
+
+ @Test
+ public void orderingorwardWorksOnTestClassRunner() {
+ Request forward = Request.aClass(OrderMe.class).orderWith(
+ AlphanumericOrdering.INSTANCE);
+
+ new JUnitCore().run(forward);
+ assertEquals("abc", log);
+ }
+
+ @Test
+ public void orderedBackwardWorksOnTestClassRunner() {
+ Request backward = Request.aClass(OrderMe.class).orderWith(
+ new ReverseAlphanumericOrdering());
+
+ new JUnitCore().run(backward);
+ assertEquals("cba", log);
+ }
+ }
+
+ public static class TestClassRunnerIsOrderableWithSuiteMethod {
+ private static String log = "";
+
+ public static class OrderMe {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(OrderMe.class);
+ }
+ }
+
+ @Before
+ public void resetLog() {
+ log = "";
+ }
+
+ @Test
+ public void orderingForwardWorksOnTestClassRunner() {
+ Request forward = Request.aClass(OrderMe.class).orderWith(AlphanumericOrdering.INSTANCE);
+
+ new JUnitCore().run(forward);
+ assertEquals("abc", log);
+ }
+
+ @Test
+ public void orderingBackwardWorksOnTestClassRunner() {
+ Request backward = Request.aClass(OrderMe.class).orderWith(
+ new ReverseAlphanumericOrdering());
+
+ new JUnitCore().run(backward);
+ assertEquals("cba", log);
+ }
+ }
+
+ public static class UnOrderableRunnersAreHandledWithoutCrashing {
+ public static class UnOrderableRunner extends Runner {
+ public UnOrderableRunner(Class> klass) {
+ }
+
+ @Override
+ public Description getDescription() {
+ return Description.EMPTY;
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ }
+ }
+
+ @RunWith(UnOrderableRunner.class)
+ public static class UnOrderable {
+ @Test
+ public void a() {
+ }
+ }
+
+ @Test
+ public void unOrderablesAreHandledWithoutCrashing() {
+ Request unordered = Request.aClass(UnOrderable.class).orderWith(
+ AlphanumericOrdering.INSTANCE);
+ new JUnitCore().run(unordered);
+ }
+ }
+}
diff --git a/src/test/java/org/junit/tests/manipulation/ReverseAlphanumericOrdering.java b/src/test/java/org/junit/tests/manipulation/ReverseAlphanumericOrdering.java
new file mode 100644
index 000000000000..b93d5c6a9887
--- /dev/null
+++ b/src/test/java/org/junit/tests/manipulation/ReverseAlphanumericOrdering.java
@@ -0,0 +1,20 @@
+package org.junit.tests.manipulation;
+
+import static java.util.Collections.reverseOrder;
+
+import org.junit.runner.manipulation.Ordering;
+
+/**
+ * An ordering that orders tests reverse alphanumerically by test name.
+ */
+public final class ReverseAlphanumericOrdering extends ComparatorBasedOrdering
+ implements Ordering.Factory {
+
+ public ReverseAlphanumericOrdering() {
+ super(reverseOrder(Comparators.alphanumeric()));
+ }
+
+ public Ordering create(Context context) {
+ return this;
+ }
+}
diff --git a/src/test/java/org/junit/tests/manipulation/ReverseAlphanumericSorter.java b/src/test/java/org/junit/tests/manipulation/ReverseAlphanumericSorter.java
new file mode 100644
index 000000000000..415253ebc62d
--- /dev/null
+++ b/src/test/java/org/junit/tests/manipulation/ReverseAlphanumericSorter.java
@@ -0,0 +1,16 @@
+package org.junit.tests.manipulation;
+
+import static java.util.Collections.reverseOrder;
+
+import org.junit.runner.manipulation.Ordering;
+import org.junit.runner.manipulation.Sorter;
+
+/**
+ * A sorter that orders tests reverse alphanumerically by test name.
+ */
+public final class ReverseAlphanumericSorter implements Ordering.Factory {
+
+ public Ordering create(Ordering.Context context) {
+ return new Sorter(reverseOrder(Comparators.alphanumeric()));
+ }
+}
diff --git a/src/test/java/org/junit/tests/manipulation/SingleMethodTest.java b/src/test/java/org/junit/tests/manipulation/SingleMethodTest.java
index c056f0a5d7dc..cf62c98e4d79 100644
--- a/src/test/java/org/junit/tests/manipulation/SingleMethodTest.java
+++ b/src/test/java/org/junit/tests/manipulation/SingleMethodTest.java
@@ -1,8 +1,8 @@
package org.junit.tests.manipulation;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import java.util.Arrays;
import java.util.List;
diff --git a/src/test/java/org/junit/tests/manipulation/SortableTest.java b/src/test/java/org/junit/tests/manipulation/SortableTest.java
index 9d10ff95f313..5857ca0f719a 100644
--- a/src/test/java/org/junit/tests/manipulation/SortableTest.java
+++ b/src/test/java/org/junit/tests/manipulation/SortableTest.java
@@ -1,11 +1,13 @@
package org.junit.tests.manipulation;
+import static java.util.Collections.reverseOrder;
import static org.junit.Assert.assertEquals;
import java.util.Comparator;
import junit.framework.JUnit4TestAdapter;
import org.junit.Before;
+import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.Description;
@@ -13,24 +15,21 @@
import org.junit.runner.Request;
import org.junit.runner.RunWith;
import org.junit.runner.Runner;
+import org.junit.runner.manipulation.Orderable;
+import org.junit.runner.manipulation.Sortable;
+import org.junit.runner.manipulation.Sorter;
import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.MethodSorters;
@RunWith(Enclosed.class)
public class SortableTest {
private static Comparator forward() {
- return new Comparator() {
- public int compare(Description o1, Description o2) {
- return o1.getDisplayName().compareTo(o2.getDisplayName());
- }
- };
+ return Comparators.alphanumeric();
}
private static Comparator backward() {
- return new Comparator() {
- public int compare(Description o1, Description o2) {
- return o2.getDisplayName().compareTo(o1.getDisplayName());
- }
- };
+ return reverseOrder(Comparators.alphanumeric());
}
public static class TestClassRunnerIsSortable {
@@ -53,6 +52,24 @@ public void c() {
}
}
+ @FixMethodOrder(MethodSorters.NAME_ASCENDING)
+ public static class DoNotSortMe {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+ }
+
@Before
public void resetLog() {
log = "";
@@ -74,6 +91,14 @@ public void sortingBackwardWorksOnTestClassRunner() {
assertEquals("cba", log);
}
+ @Test
+ public void sortingBackwardDoesNothingOnTestClassRunnerWithFixMethodOrder() {
+ Request backward = Request.aClass(DoNotSortMe.class).sortWith(backward());
+
+ new JUnitCore().run(backward);
+ assertEquals("abc", log);
+ }
+
@RunWith(Enclosed.class)
public static class Enclosing {
public static class A {
@@ -202,4 +227,76 @@ public void unsortablesAreHandledWithoutCrashing() {
new JUnitCore().run(unsorted);
}
}
+
+ public static class TestOnlySortableClassRunnerIsSortable {
+ private static String log = "";
+
+ /**
+ * A Runner that implements {@link Sortable} but not {@link Orderable}.
+ */
+ public static class SortableRunner extends Runner implements Sortable {
+ private final BlockJUnit4ClassRunner delegate;
+
+ public SortableRunner(Class> klass) throws Throwable {
+ delegate = new BlockJUnit4ClassRunner(klass);
+ }
+
+ @Override
+ public void run(RunNotifier notifier) {
+ delegate.run(notifier);
+ }
+
+ @Override
+ public Description getDescription() {
+ return delegate.getDescription();
+ }
+
+ public void sort(Sorter sorter) {
+ delegate.sort(sorter);
+ }
+ }
+
+ @RunWith(SortableRunner.class)
+ public static class SortMe {
+ @Test
+ public void a() {
+ log += "a";
+ }
+
+ @Test
+ public void b() {
+ log += "b";
+ }
+
+ @Test
+ public void c() {
+ log += "c";
+ }
+
+ public static junit.framework.Test suite() {
+ return new JUnit4TestAdapter(SortMe.class);
+ }
+ }
+
+ @Before
+ public void resetLog() {
+ log = "";
+ }
+
+ @Test
+ public void sortingForwardWorksOnTestClassRunner() {
+ Request forward = Request.aClass(SortMe.class).sortWith(forward());
+
+ new JUnitCore().run(forward);
+ assertEquals("abc", log);
+ }
+
+ @Test
+ public void sortingBackwardWorksOnTestClassRunner() {
+ Request backward = Request.aClass(SortMe.class).sortWith(backward());
+
+ new JUnitCore().run(backward);
+ assertEquals("cba", log);
+ }
+ }
}
diff --git a/src/test/java/org/junit/tests/running/classes/AllClassesTests.java b/src/test/java/org/junit/tests/running/classes/AllClassesTests.java
index dbce23dcae83..793090c34b0c 100644
--- a/src/test/java/org/junit/tests/running/classes/AllClassesTests.java
+++ b/src/test/java/org/junit/tests/running/classes/AllClassesTests.java
@@ -17,7 +17,8 @@
ParentRunnerClassLoaderTest.class,
RunWithTest.class,
SuiteTest.class,
- UseSuiteAsASuperclassTest.class
+ UseSuiteAsASuperclassTest.class,
+ ThreadsTest.class
})
public class AllClassesTests {
}
diff --git a/src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java b/src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java
index 6f610e4fa8ac..14fb825df5bc 100644
--- a/src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java
+++ b/src/test/java/org/junit/tests/running/classes/ParameterizedTestTest.java
@@ -7,10 +7,9 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.Assume.assumeFalse;
import static org.junit.experimental.results.PrintableResult.testResult;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -29,7 +28,6 @@
import org.junit.runner.RunWith;
import org.junit.runner.Runner;
import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunListener;
import org.junit.runners.MethodSorters;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
@@ -768,16 +766,16 @@ public void usesParametersRunnerFactoryThatWasSpecifiedByAnnotationInSuperClass(
}
@RunWith(Parameterized.class)
- public static class ParameterizedAssumtionViolation {
- static boolean condition;
+ public static class AssumptionInParametersMethod {
+ static boolean assumptionFails;
@Parameters
public static Iterable data() {
- assumeTrue(condition);
+ assumeFalse(assumptionFails);
return Collections.singletonList("foobar");
}
- public ParameterizedAssumtionViolation(String parameter) {
+ public AssumptionInParametersMethod(String parameter) {
}
@Test
@@ -790,25 +788,22 @@ public void test2() {
}
@Test
- public void assumtionViolationInParameters() {
- ParameterizedAssumtionViolation.condition = true;
- Result successResult = JUnitCore.runClasses(ParameterizedAssumtionViolation.class);
- assertTrue(successResult.wasSuccessful());
- assertEquals(2, successResult.getRunCount());
-
- ParameterizedAssumtionViolation.condition = false;
- JUnitCore core = new JUnitCore();
- final List assumptionFailures = new ArrayList();
- core.addListener(new RunListener() {
- @Override
- public void testAssumptionFailure(Failure failure) {
- assumptionFailures.add(failure);
- }
- });
- Result failureResult = core.run(ParameterizedAssumtionViolation.class);
- assertTrue(failureResult.wasSuccessful());
- assertEquals(0, failureResult.getRunCount());
- assertEquals(0, failureResult.getIgnoreCount());
- assertEquals(1, assumptionFailures.size());
+ public void testsAreExecutedWhenAssumptionInParametersMethodDoesNotFail() {
+ AssumptionInParametersMethod.assumptionFails = false;
+ Result result = JUnitCore.runClasses(AssumptionInParametersMethod.class);
+ assertTrue(result.wasSuccessful());
+ assertEquals(0, result.getAssumptionFailureCount());
+ assertEquals(0, result.getIgnoreCount());
+ assertEquals(2, result.getRunCount());
+ }
+
+ @Test
+ public void testsAreNotExecutedWhenAssumptionInParametersMethodFails() {
+ AssumptionInParametersMethod.assumptionFails = true;
+ Result result = JUnitCore.runClasses(AssumptionInParametersMethod.class);
+ assertTrue(result.wasSuccessful());
+ assertEquals(1, result.getAssumptionFailureCount());
+ assertEquals(0, result.getIgnoreCount());
+ assertEquals(0, result.getRunCount());
}
}
diff --git a/src/test/java/org/junit/tests/running/classes/ParentRunnerFilteringTest.java b/src/test/java/org/junit/tests/running/classes/ParentRunnerFilteringTest.java
index 12e12b428d86..1c1d9d1c34eb 100644
--- a/src/test/java/org/junit/tests/running/classes/ParentRunnerFilteringTest.java
+++ b/src/test/java/org/junit/tests/running/classes/ParentRunnerFilteringTest.java
@@ -1,7 +1,7 @@
package org.junit.tests.running.classes;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;
@@ -95,9 +95,9 @@ public void testSuiteFiltering() throws Exception {
fail("Expected 'NoTestsRemainException' due to complete filtering");
}
- public static class SuiteWithUnmodifyableChildList extends Suite {
+ public static class SuiteWithUnmodifiableChildList extends Suite {
- public SuiteWithUnmodifyableChildList(
+ public SuiteWithUnmodifiableChildList(
Class> klass, RunnerBuilder builder)
throws InitializationError {
super(klass, builder);
@@ -109,14 +109,14 @@ protected List getChildren() {
}
}
- @RunWith(SuiteWithUnmodifyableChildList.class)
+ @RunWith(SuiteWithUnmodifiableChildList.class)
@SuiteClasses({ExampleTest.class})
- public static class ExampleSuiteWithUnmodifyableChildList {
+ public static class ExampleSuiteWithUnmodifiableChildList {
}
@Test
- public void testSuiteFilteringWithUnmodifyableChildList() throws Exception {
- Runner runner = Request.aClass(ExampleSuiteWithUnmodifyableChildList.class)
+ public void testSuiteFilteringWithUnmodifiableChildList() throws Exception {
+ Runner runner = Request.aClass(ExampleSuiteWithUnmodifiableChildList.class)
.getRunner();
Filter filter = notThisMethodName("test1");
try {
diff --git a/src/test/java/org/junit/tests/running/classes/ParentRunnerTest.java b/src/test/java/org/junit/tests/running/classes/ParentRunnerTest.java
index a8eabbe8ccdf..9b18ed14492c 100644
--- a/src/test/java/org/junit/tests/running/classes/ParentRunnerTest.java
+++ b/src/test/java/org/junit/tests/running/classes/ParentRunnerTest.java
@@ -2,8 +2,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import java.util.List;
diff --git a/src/test/java/org/junit/tests/running/classes/SuiteTest.java b/src/test/java/org/junit/tests/running/classes/SuiteTest.java
index bb4ebac97f48..42b492edaad1 100644
--- a/src/test/java/org/junit/tests/running/classes/SuiteTest.java
+++ b/src/test/java/org/junit/tests/running/classes/SuiteTest.java
@@ -1,7 +1,7 @@
package org.junit.tests.running.classes;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.experimental.results.PrintableResult.testResult;
import static org.junit.experimental.results.ResultMatchers.hasSingleFailureContaining;
diff --git a/src/test/java/org/junit/tests/running/classes/ThreadsTest.java b/src/test/java/org/junit/tests/running/classes/ThreadsTest.java
new file mode 100644
index 000000000000..2965187e3365
--- /dev/null
+++ b/src/test/java/org/junit/tests/running/classes/ThreadsTest.java
@@ -0,0 +1,83 @@
+package org.junit.tests.running.classes;
+
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.RunWith;
+import org.junit.runner.notification.RunListener;
+import org.junit.runners.BlockJUnit4ClassRunner;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.singletonList;
+import static org.junit.Assert.assertEquals;
+
+public class ThreadsTest {
+
+ private List interruptedFlags = new ArrayList();
+ private JUnitCore core = new JUnitCore();
+
+ public static class TestWithInterrupt {
+
+ @Test
+ public void interruptCurrentThread() {
+ Thread.currentThread().interrupt();
+ }
+
+ @Test
+ public void otherTestCaseInterruptingCurrentThread() {
+ Thread.currentThread().interrupt();
+ }
+
+ }
+
+ @Test
+ public void currentThreadInterruptedStatusIsClearedAfterEachTestExecution() {
+ core.addListener(new RunListener() {
+ @Override
+ public void testFinished(Description description) {
+ interruptedFlags.add(Thread.currentThread().isInterrupted());
+ }
+ });
+
+ Result result = core.run(TestWithInterrupt.class);
+
+ assertEquals(0, result.getFailureCount());
+ assertEquals(asList(false, false), interruptedFlags);
+ }
+
+ @RunWith(BlockJUnit4ClassRunner.class)
+ public static class TestWithInterruptFromAfterClass {
+ @AfterClass
+ public static void interruptCurrentThread() {
+ Thread.currentThread().interrupt();
+ }
+
+ @Test
+ public void test() {
+ // no-op
+ }
+ }
+
+ @Test
+ public void currentThreadInterruptStatusIsClearedAfterSuiteExecution() {
+ core.addListener(new RunListener() {
+ @Override
+ public void testSuiteFinished(Description description) {
+ interruptedFlags.add(Thread.currentThread().isInterrupted());
+ }
+ });
+
+ Request request = Request.aClass(TestWithInterruptFromAfterClass.class);
+
+ Result result = core.run(request);
+
+ assertEquals(0, result.getFailureCount());
+ assertEquals(singletonList(false), interruptedFlags);
+ }
+}
diff --git a/src/test/java/org/junit/tests/running/methods/AnnotationTest.java b/src/test/java/org/junit/tests/running/methods/AnnotationTest.java
index 7724455b4919..593cdb1c27a6 100644
--- a/src/test/java/org/junit/tests/running/methods/AnnotationTest.java
+++ b/src/test/java/org/junit/tests/running/methods/AnnotationTest.java
@@ -633,13 +633,13 @@ public void test() {
}
}
- public void testFieldsNeverTreatedAsShadowed() throws Exception {
+ public void testFieldsShadowFieldsFromParent() throws Exception {
log = "";
assertThat(testResult(SubFieldShadowing.class), isSuccessful());
assertEquals(
- "super.rule.before() sub.rule.before() "
+ "sub.rule.before() "
+ "Test "
- + "sub.rule.after() super.rule.after() ",
+ + "sub.rule.after() ",
log);
}
diff --git a/src/test/java/org/junit/tests/running/methods/TimeoutTest.java b/src/test/java/org/junit/tests/running/methods/TimeoutTest.java
index 8d23909bd893..21095fd15742 100644
--- a/src/test/java/org/junit/tests/running/methods/TimeoutTest.java
+++ b/src/test/java/org/junit/tests/running/methods/TimeoutTest.java
@@ -3,8 +3,8 @@
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
diff --git a/src/test/java/org/junit/tests/validation/BadlyFormedClassesTest.java b/src/test/java/org/junit/tests/validation/BadlyFormedClassesTest.java
index df49713bc6a4..d35de2cd2f4d 100644
--- a/src/test/java/org/junit/tests/validation/BadlyFormedClassesTest.java
+++ b/src/test/java/org/junit/tests/validation/BadlyFormedClassesTest.java
@@ -1,8 +1,8 @@
package org.junit.tests.validation;
import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
import org.junit.Before;
import org.junit.Test;
diff --git a/src/test/java/org/junit/validator/AnnotationValidatorFactoryTest.java b/src/test/java/org/junit/validator/AnnotationValidatorFactoryTest.java
index 4003ff347280..064d4a3aff77 100644
--- a/src/test/java/org/junit/validator/AnnotationValidatorFactoryTest.java
+++ b/src/test/java/org/junit/validator/AnnotationValidatorFactoryTest.java
@@ -2,7 +2,7 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -14,13 +14,13 @@ public class AnnotationValidatorFactoryTest {
@Test
public void createAnnotationValidator() {
- ValidateWith validateWith = SampleTestWithValidator.class.getAnnotation(ValidateWith.class);
+ ValidateWith validateWith = SampleAnnotationWithValidator.class.getAnnotation(ValidateWith.class);
AnnotationValidator annotationValidator = new AnnotationValidatorFactory().createAnnotationValidator(validateWith);
assertThat(annotationValidator, is(instanceOf(Validator.class)));
}
@ValidateWith(value = Validator.class)
- public static class SampleTestWithValidator {
+ public @interface SampleAnnotationWithValidator {
}
public static class Validator extends AnnotationValidator {
@@ -28,7 +28,7 @@ public static class Validator extends AnnotationValidator {
@Test
public void exceptionWhenAnnotationValidatorCantBeCreated() {
- ValidateWith validateWith = SampleTestWithValidatorThatThrowsException.class.getAnnotation(ValidateWith.class);
+ ValidateWith validateWith = SampleAnnotationWithValidatorThatThrowsException.class.getAnnotation(ValidateWith.class);
exception.expect(RuntimeException.class);
exception.expectMessage("Exception received when creating AnnotationValidator class " +
"org.junit.validator.AnnotationValidatorFactoryTest$ValidatorThatThrowsException");
@@ -36,7 +36,7 @@ public void exceptionWhenAnnotationValidatorCantBeCreated() {
}
@ValidateWith(value = ValidatorThatThrowsException.class)
- public static class SampleTestWithValidatorThatThrowsException {
+ public @interface SampleAnnotationWithValidatorThatThrowsException {
}
public static class ValidatorThatThrowsException extends AnnotationValidator {
diff --git a/src/test/java/org/junit/validator/AnnotationsValidatorTest.java b/src/test/java/org/junit/validator/AnnotationsValidatorTest.java
index 657330930274..0be3cecb5903 100644
--- a/src/test/java/org/junit/validator/AnnotationsValidatorTest.java
+++ b/src/test/java/org/junit/validator/AnnotationsValidatorTest.java
@@ -2,7 +2,7 @@
import static java.util.Arrays.asList;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.hamcrest.MatcherAssert.assertThat;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;