Merge "Improved test coverage for GarageModeService" into sc-dev
diff --git a/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java b/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java
index c1b45d3..cd9adfb 100644
--- a/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java
+++ b/tests/carservice_test/src/com/android/car/garagemode/GarageModeServiceTest.java
@@ -60,6 +60,15 @@
}
@Test
+ public void testInitAndRelease() {
+ mService.init();
+ mService.release();
+
+ verify(mMockController).init();
+ verify(mMockController).release();
+ }
+
+ @Test
public void testDump_shouldSucceed() {
when(mMockController.isGarageModeActive()).thenReturn(true);
@@ -68,4 +77,33 @@
List<String> strings = mCaptorString.getAllValues();
assertThat(strings.get(0)).isEqualTo("GarageModeInProgress true");
}
+
+ @Test
+ public void testIsGarageModeActive_true() {
+ when(mMockController.isGarageModeActive()).thenReturn(true);
+
+ assertThat(mService.isGarageModeActive()).isTrue();
+ }
+
+ @Test
+ public void testIsGarageModeActive_false() {
+ when(mMockController.isGarageModeActive()).thenReturn(false);
+
+ assertThat(mService.isGarageModeActive()).isFalse();
+ }
+
+ @Test
+ public void testForceStartGarageMode() {
+ mService.forceStartGarageMode();
+
+ verify(mMockController).initiateGarageMode(null);
+ }
+
+ @Test
+ public void testStopAndResetGarageMode() {
+ mService.stopAndResetGarageMode();
+
+ verify(mMockController).resetGarageMode();
+ }
+
}