Support handling multiple static mocks.
This CL introduces a "StaticMockFixture" interface that allows setting up the classes to be mocked in a StaticMockitoSessionBuilder and separately setting up the default behaviour of the so-mocked classes, as well as tearing them down. It also introduces a StaticMockFixtureRule that takes some number of StaticMockFixture instances or suppliers thereof, and manages them all within the same StaticMockitoSession and its builder. This in turn allows us to use such a StaticMockFixtureRule to orchestrate the automatic set-up and tear-down of different sets of static mocks, all within the same StatickMockitoSession, since juggling multiple StaticMockitoSessions turns out to be tricky and full of pitfalls. Finally this change refactors TestableDeviceConfig to become a StaticMockFixture which can then be used together with other static mocks, and to separately offer a TestableDeviceConfigRule that can be used when no other static mocks are required to manage the TestableDeviceConfig on its own. Change-Id: Icd88736390699e8956cd3d6923636afc0e015440 Test: included in CL. Bug: 129937393
Loading
Please register or sign in to comment