aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlmaz Mingaleev <mingaleev@google.com>2024-05-02 14:18:58 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-05-02 14:18:58 +0000
commit5683b5b5286d1fdef0144bd4f4e2e8db538f7be7 (patch)
treea6b2c802f2d4722dc3dc0bc747bfc4a54163a00d
parentc4b7a5a7da0b9d905cc77b567c53d19bf8a0ef91 (diff)
parent10e233f53c71ac5db403e1ea50223ac324b3b61f (diff)
downloadlibcore-master.tar.gz
Merge "Add missing JUnit @Rule-s." into mainHEADmastermain
-rw-r--r--luni/src/test/java/libcore/java/util/FormatterTest.java6
-rw-r--r--luni/src/test/java/libcore/java/util/RandomTest.java6
2 files changed, 12 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/java/util/FormatterTest.java b/luni/src/test/java/libcore/java/util/FormatterTest.java
index 4e4c4d5f741..abca282a564 100644
--- a/luni/src/test/java/libcore/java/util/FormatterTest.java
+++ b/luni/src/test/java/libcore/java/util/FormatterTest.java
@@ -30,6 +30,7 @@ import static java.nio.charset.StandardCharsets.UTF_8;
import dalvik.annotation.compat.VersionCodes;
import dalvik.system.VMRuntime;
+import libcore.junit.util.compat.CoreCompatChangeRule;
import libcore.junit.util.compat.CoreCompatChangeRule.DisableCompatChanges;
import libcore.junit.util.compat.CoreCompatChangeRule.EnableCompatChanges;
import libcore.test.annotation.NonMts;
@@ -37,7 +38,9 @@ import libcore.test.reasons.NonMtsReasons;
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TestRule;
import java.io.File;
import java.io.FileOutputStream;
@@ -60,6 +63,9 @@ import java.util.TimeZone;
@SuppressWarnings("FormatString")
public class FormatterTest {
+ @Rule
+ public final TestRule compatChangeRule = new CoreCompatChangeRule();
+
private File aFile;
@Before
diff --git a/luni/src/test/java/libcore/java/util/RandomTest.java b/luni/src/test/java/libcore/java/util/RandomTest.java
index ead9f69b5c6..5b2c3634d9b 100644
--- a/luni/src/test/java/libcore/java/util/RandomTest.java
+++ b/luni/src/test/java/libcore/java/util/RandomTest.java
@@ -22,9 +22,12 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import libcore.junit.util.compat.CoreCompatChangeRule;
import libcore.junit.util.compat.CoreCompatChangeRule.DisableCompatChanges;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.TestRule;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -34,6 +37,9 @@ import java.util.Random;
@RunWith(JUnit4.class)
public class RandomTest {
+ @Rule
+ public final TestRule compatChangeRule = new CoreCompatChangeRule();
+
@Test
public void test_subclassing() throws Exception {
// http://b/2502231