diff options
author | Paul Duffin <paulduffin@google.com> | 2017-06-26 09:50:09 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-06-26 09:50:09 +0000 |
commit | 19290e456f9316aa965c5d88680a94f9e8787669 (patch) | |
tree | 22b79b5e73c917c83bc72d781edf7afe6f8ea71c /test-runner/src | |
parent | d9dd77ea6a04ccea47c9366785ec7d7171c5c32a (diff) | |
parent | ad654a3af546764a6840cdb8521dd7aab5facb43 (diff) |
Merge "Clean up TestCaseUtil" am: 43851d01d8 am: e38d503394 am: b5b6e7cf45
am: ad654a3af5
Change-Id: Idd36689c3a90728ee543be0ffa7457fe79b66ba3
Diffstat (limited to 'test-runner/src')
-rw-r--r-- | test-runner/src/android/test/TestCaseUtil.java | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/test-runner/src/android/test/TestCaseUtil.java b/test-runner/src/android/test/TestCaseUtil.java index dc053a2359a0..156290997a1b 100644 --- a/test-runner/src/android/test/TestCaseUtil.java +++ b/test-runner/src/android/test/TestCaseUtil.java @@ -40,16 +40,6 @@ public class TestCaseUtil { private TestCaseUtil() { } - @SuppressWarnings("unchecked") - public static List<String> getTestCaseNames(Test test, boolean flatten) { - List<Test> tests = (List<Test>) getTests(test, flatten); - List<String> testCaseNames = new ArrayList<>(); - for (Test aTest : tests) { - testCaseNames.add(getTestName(aTest)); - } - return testCaseNames; - } - public static List<? extends Test> getTests(Test test, boolean flatten) { return getTests(test, flatten, new HashSet<Class<?>>()); } @@ -92,7 +82,7 @@ public class TestCaseUtil { return testCases; } - private static Test invokeSuiteMethodIfPossible(Class testClass, + static Test invokeSuiteMethodIfPossible(Class testClass, Set<Class<?>> seen) { try { Method suiteMethod = testClass.getMethod( @@ -120,7 +110,7 @@ public class TestCaseUtil { return null; } - public static String getTestName(Test test) { + static String getTestName(Test test) { if (test instanceof TestCase) { TestCase testCase = (TestCase) test; return testCase.getName(); @@ -138,34 +128,4 @@ public class TestCaseUtil { } return ""; } - - public static Test getTestAtIndex(TestSuite testSuite, int position) { - int index = 0; - Enumeration enumeration = testSuite.tests(); - while (enumeration.hasMoreElements()) { - Test test = (Test) enumeration.nextElement(); - if (index == position) { - return test; - } - index++; - } - return null; - } - - public static TestSuite createTestSuite(Class<? extends Test> testClass) - throws InstantiationException, IllegalAccessException { - - Test test = invokeSuiteMethodIfPossible(testClass, - new HashSet<Class<?>>()); - if (test == null) { - return new TestSuite(testClass); - - } else if (TestCase.class.isAssignableFrom(test.getClass())) { - TestSuite testSuite = new TestSuite(test.getClass().getName()); - testSuite.addTest(test); - return testSuite; - } - - return (TestSuite) test; - } } |