aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/junit/Assume.java
diff options
context:
space:
mode:
authorPete Bentley <prb@google.com>2021-03-03 15:09:19 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-03-03 15:09:19 +0000
commit4ea71685c0a1bda87567b2d1ef5ed651d9c2608b (patch)
tree10923530939981dd1dc5f44ceb6316fb9442428a /src/main/java/org/junit/Assume.java
parent5cb7d97d73027edb2274ac39e8a958bab5e2e7b3 (diff)
parenta9a7715d84046efd231e038b0dc2f551daf61701 (diff)
downloadjunit-4ea71685c0a1bda87567b2d1ef5ed651d9c2608b.tar.gz
Merge changes I578a2676,I4b37c2d0,Id1e2d638,I1ebe37da,I6135799c am: b6446bec0a am: fcd81b3e3f am: c7a6d4ec7d am: a9a7715d84
Original change: https://android-review.googlesource.com/c/platform/external/junit/+/1613132 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I56f45d05317bd1060b5838f1ada3a90bb2985d55
Diffstat (limited to 'src/main/java/org/junit/Assume.java')
-rw-r--r--src/main/java/org/junit/Assume.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/main/java/org/junit/Assume.java b/src/main/java/org/junit/Assume.java
index b7687f7..29b705b 100644
--- a/src/main/java/org/junit/Assume.java
+++ b/src/main/java/org/junit/Assume.java
@@ -14,7 +14,7 @@ import org.hamcrest.Matcher;
* basically means "don't run this test if these conditions don't apply". The default JUnit runner skips tests with
* failing assumptions. Custom runners may behave differently.
* <p>
- * A good example of using assumptions is in <a href="https://github.com/junit-team/junit/wiki/Theories">Theories</a> where they are needed to exclude certain datapoints that aren't suitable or allowed for a certain test case.
+ * A good example of using assumptions is in <a href="https://github.com/junit-team/junit4/wiki/Theories">Theories</a> where they are needed to exclude certain datapoints that aren't suitable or allowed for a certain test case.
* </p>
* Failed assumptions are usually not logged, because there may be many tests that don't apply to certain
* configurations.
@@ -29,11 +29,20 @@ import org.hamcrest.Matcher;
* </pre>
* </p>
*
- * @see <a href="https://github.com/junit-team/junit/wiki/Theories">Theories</a>
+ * @see <a href="https://github.com/junit-team/junit4/wiki/Theories">Theories</a>
*
* @since 4.4
*/
public class Assume {
+
+ /**
+ * Do not instantiate.
+ * @deprecated since 4.13.
+ */
+ @Deprecated
+ public Assume() {
+ }
+
/**
* If called with an expression evaluating to {@code false}, the test will halt and be ignored.
*/
@@ -45,7 +54,7 @@ public class Assume {
* The inverse of {@link #assumeTrue(boolean)}.
*/
public static void assumeFalse(boolean b) {
- assumeTrue(!b);
+ assumeThat(b, is(false));
}
/**
@@ -67,9 +76,11 @@ public class Assume {
}
/**
- * If called with one or more null elements in <code>objects</code>, the test will halt and be ignored.
+ * If called with a {@code null} array or one or more {@code null} elements in {@code objects},
+ * the test will halt and be ignored.
*/
public static void assumeNotNull(Object... objects) {
+ assumeThat(objects, notNullValue());
assumeThat(asList(objects), everyItem(notNullValue()));
}