Android Wear 7.1.1 Release 1 (NXG12F)
Use JUnit classes for running JUnit4 tests
Removes the custom code for handling JUnit4 classes and switches
to use standard JUnit classes, albeit heavily customised.
A couple of changes to the tests:
* TestRunnerJUnit4Test#testRunner_SuiteTest
The order is different from previous version of Vogar as that
sorted a flattened list but JUnit has it organized as a
hierarchy and sorts each parent's children separately so tests
which have a different parent like SimpleTest2 and SimpleTest3
are not sorted relative to each other.
* TestRunnerJUnit4Test#testRunner_AnnotatedMethodsTest
Added test because Vogar can now handle the annotations
@BeforeClass/AfterClass. It could not do that previously
because it had a flat list rather than grouping tests by
class.
* MockitoFieldTest
Added @RunWith(MockitoJUnitRunner.class) to replace the
reflective call to MockitoAnnotations.initMocks(Object) that
was previously done for all JUnit 4 tests. Presumably, Vogar
did that because it only had a partial implementation of JUnit
4 test running infrastructure and so could not support the
@RunWith mechanism.
The removal of the implicit reflective call to
MockitoAnnotations.initMocks(Object) does change the behavior
but was removed anyway because:
* There do not appear to be any tests that depend on it, at
least not in aosp/master.
* There are not many JUnit 4 tests because Vogar does not
support it very well.
* Vogar is primarily for Android developers and most of the
tests that they run they write will also be part of CTS which
requires that they do something in the test to initialize the
@Mock annotated fields, e.g. use
@RunWith(MockitoJUnitRunner.class) or explicitly call
MockitoAnnotations.initMocks(this).
* Given that Vogar now supports standard JUnit 4 it is easy to
fix any broken tests.
* It's not particularly helpful.
Testing: Build vogar-tests and run them,
run art/tools/run-libcore-tests.sh
Bug: 27940141
Change-Id: I9fd993395b52620162176a4d4c5930ded746857c
17 files changed