Check initialization of @org.mockito.Mock annotated fields

Vogar's partial implementation of JUnit 4 attempts to call
MockitoAnnotations.initMocks(Object) on the test object. This
is not standard JUnit 4 behavior and presumably was added to
support tests that use @Mock annotated fields without having to
support one of the standard ways of doing that:
* Annotating the class with @RunWith(MockitoJUnitRunner.class).
* Invoking MockitoAnnotations.initMocks(this) in an instance
  method annotated with @Before
* In version 1.10.17 or later of Mockito use of the MockitoRule.

Given that this only works in Vogar, and most of the tests have
to run in CTS as well this does not actually achieve very much
except create an unnecessary difference in behavior between
Vogar and CTS.

A search of the Android source code did not find any code that
would be affected by this change, although of course it is
possible that some would exist outside the central repository.

The code will not be removed until Vogar is switched over to
support JUnit 4 tests properly because otherwise the preferred
mechanism of using @RunWith(MockitoJUnitRunner.class) will not
work. This change adds a test to verify that Vogar does
initialize the mocks automatically. Once switched over to using
standard JUnit 4 the test will be used to verify that
@RunWith(MockitoJUnitRunner.class) works properly.

Bug: 27940141
Testing: Build vogar-tests and run them,
run art/tools/run-libcore-tests.sh

Change-Id: I6e4a08a5e8a8ca259a10d297ce19b8d0b8a4ed7e
2 files changed