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:
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.
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
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
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
* 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,
17 files changed