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

Commit 38ed89d6 authored by Jack He's avatar Jack He
Browse files

HFP: Fix clearAdapterService call in unit tests

* clearAdapterService() now takes an argument to execute
* HeadsetServiceTest and HeadsetStateMachineTest need to be updated to
  reflect this change

Bug: 67460963
Test: runtest -j32 bluetooth
Change-Id: I293ad6795b50813690b02277381aadd1b6e941ff
parent eee0a9c7
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -103,9 +103,9 @@ public class HeadsetServiceTest {
    @AfterClass
    @AfterClass
    public static void tearDownClassOnlyOnce() throws Exception {
    public static void tearDownClassOnlyOnce() throws Exception {
        Method method =
        Method method =
                AdapterService.class.getDeclaredMethod("clearAdapterService");
                AdapterService.class.getDeclaredMethod("clearAdapterService", AdapterService.class);
        method.setAccessible(true);
        method.setAccessible(true);
        method.invoke(null);
        method.invoke(null, sAdapterService);
        sAdapterService = null;
        sAdapterService = null;
        method = HeadsetObjectsFactory.class.getDeclaredMethod("setInstanceForTesting",
        method = HeadsetObjectsFactory.class.getDeclaredMethod("setInstanceForTesting",
                HeadsetObjectsFactory.class);
                HeadsetObjectsFactory.class);
+2 −2
Original line number Original line Diff line number Diff line
@@ -85,9 +85,9 @@ public class HeadsetStateMachineTest {
    @AfterClass
    @AfterClass
    public static void tearDownOnlyOnce() throws Exception {
    public static void tearDownOnlyOnce() throws Exception {
        Method method =
        Method method =
                AdapterService.class.getDeclaredMethod("clearAdapterService");
                AdapterService.class.getDeclaredMethod("clearAdapterService", AdapterService.class);
        method.setAccessible(true);
        method.setAccessible(true);
        method.invoke(null);
        method.invoke(null, sAdapterService);
        sAdapterService = null;
        sAdapterService = null;
    }
    }