From c8055484aac0d002d00140b789711414f4130428 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 14 Dec 2016 12:55:56 +0000 Subject: Remove DisableOnDebug (new in 4.12) as it is not supported on Android It requires classes from the java.lang.management package which is not supported on Android. Bug: 33613916 Test: make checkbuild - fails but not in DisableOnDebug Change-Id: If43a90d1dde7d3c2141001bcc7cb33c3c2b3964c --- README.version | 1 + src/main/java/org/junit/rules/DisableOnDebug.java | 127 ---------------------- 2 files changed, 1 insertion(+), 127 deletions(-) delete mode 100644 src/main/java/org/junit/rules/DisableOnDebug.java diff --git a/README.version b/README.version index 05061c4..85b3bfa 100644 --- a/README.version +++ b/README.version @@ -3,3 +3,4 @@ Version: 4.12 BugComponent: 40416 Local Changes: + Remove DisableOnDebug (new in 4.12) as it is not supported on Android diff --git a/src/main/java/org/junit/rules/DisableOnDebug.java b/src/main/java/org/junit/rules/DisableOnDebug.java deleted file mode 100644 index afa6dee..0000000 --- a/src/main/java/org/junit/rules/DisableOnDebug.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.junit.rules; - -import java.lang.management.ManagementFactory; -import java.lang.management.RuntimeMXBean; -import java.util.List; - -import org.junit.runner.Description; -import org.junit.runners.model.Statement; - -/** - * The {@code DisableOnDebug} Rule allows you to label certain rules to be - * disabled when debugging. - *

- * The most illustrative use case is for tests that make use of the - * {@link Timeout} rule, when ran in debug mode the test may terminate on - * timeout abruptly during debugging. Developers may disable the timeout, or - * increase the timeout by making a code change on tests that need debugging and - * remember revert the change afterwards or rules such as {@link Timeout} that - * may be disabled during debugging may be wrapped in a {@code DisableOnDebug}. - *

- * The important benefit of this feature is that you can disable such rules - * without any making any modifications to your test class to remove them during - * debugging. - *

- * This does nothing to tackle timeouts or time sensitive code under test when - * debugging and may make this less useful in such circumstances. - *

- * Example usage: - * - *

- * public static class DisableTimeoutOnDebugSampleTest {
- * 
- *     @Rule
- *     public TestRule timeout = new DisableOnDebug(new Timeout(20));
- * 
- *     @Test
- *     public void myTest() {
- *         int i = 0;
- *         assertEquals(0, i); // suppose you had a break point here to inspect i
- *     }
- * }
- * 
- * - * @since 4.12 - */ -public class DisableOnDebug implements TestRule { - private final TestRule rule; - private final boolean debugging; - - /** - * Create a {@code DisableOnDebug} instance with the timeout specified in - * milliseconds. - * - * @param rule to disable during debugging - */ - public DisableOnDebug(TestRule rule) { - this(rule, ManagementFactory.getRuntimeMXBean() - .getInputArguments()); - } - - /** - * Visible for testing purposes only. - * - * @param rule the rule to disable during debugging - * @param inputArguments - * arguments provided to the Java runtime - */ - DisableOnDebug(TestRule rule, List inputArguments) { - this.rule = rule; - debugging = isDebugging(inputArguments); - } - - /** - * @see TestRule#apply(Statement, Description) - */ - public Statement apply(Statement base, Description description) { - if (debugging) { - return base; - } else { - return rule.apply(base, description); - } - } - - /** - * Parses arguments passed to the runtime environment for debug flags - *

- * Options specified in: - *