Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 36ef8f07 authored by Felipe Leme's avatar Felipe Leme
Browse files

Improved ExtendedMockitoTestCase to make it more error prone.

- Make sure session is properly closed, as Mockito keeps static
  references to the sessions (and when one test fails to close a
  session, all subsequent tests would fail).
- Clear inline mocks after each test to avoid OOM (see b/259280359
  and https://github.com/mockito/mockito/issues/1614)
- Convert AlarmManagerServiceTest to extend ExtendedMockitoTestCase
- Also disabled CachedAppOptimizerTest, which was failing (without
  this change and for months - b/226641572) and cannot use
  ExtendedMockitoTestCase "as is" because it uses a @Rule that also
  starts a mockito session.

Notice that to fully take advantage of these improvements, all
classes should extend ExtendedMockitoTestCase; this CL just changed
a few classes so the suite finishes without crashing with OOM and
UserVisibilityMediatorMUMDTest doesn't fail due to other tests not
closing the session.

NOTE: these improvements already exist on AbstractExtendedMockitoTestCase
(from android.car.test.mocks) which is what ExtendedMockitoTestCase is
based on.

Test: atest FrameworksMockingServicesTests

Fixes: 267765119
Bug: 226641572

Change-Id: I2c0abe930521d9babda90c393003d8730fa67e96
parent c7f6a80c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment