11package com .smartdevicelink .managers .lockscreen ;
22
33import android .content .Context ;
4+ import android .support .test .runner .AndroidJUnit4 ;
45
5- import com .smartdevicelink .AndroidTestCase2 ;
66import com .smartdevicelink .protocol .enums .FunctionID ;
77import com .smartdevicelink .proxy .interfaces .ISdl ;
88import com .smartdevicelink .proxy .rpc .OnDriverDistraction ;
1212import com .smartdevicelink .proxy .rpc .listeners .OnRPCNotificationListener ;
1313import com .smartdevicelink .test .TestValues ;
1414
15+ import org .junit .Before ;
16+ import org .junit .Test ;
17+ import org .junit .runner .RunWith ;
1518import org .mockito .invocation .InvocationOnMock ;
1619import org .mockito .stubbing .Answer ;
1720
21+ import static android .support .test .InstrumentationRegistry .getContext ;
22+ import static junit .framework .TestCase .assertEquals ;
23+ import static junit .framework .TestCase .assertFalse ;
24+ import static junit .framework .TestCase .assertNull ;
25+ import static junit .framework .TestCase .assertTrue ;
1826import static org .mockito .ArgumentMatchers .any ;
1927import static org .mockito .ArgumentMatchers .eq ;
2028import static org .mockito .Mockito .doAnswer ;
2432 * This is a unit test class for the SmartDeviceLink library manager class :
2533 * {@link com.smartdevicelink.managers.lockscreen.LockScreenManager}
2634 */
27- public class LockScreenManagerTests extends AndroidTestCase2 {
35+ @ RunWith (AndroidJUnit4 .class )
36+ public class LockScreenManagerTests {
2837
2938 private LockScreenManager lockScreenManager ;
3039 private OnRPCNotificationListener onDDListener ;
3140
32- @ Override
41+ @ Before
3342 public void setUp () throws Exception {
34- super .setUp ();
3543
3644 ISdl internalInterface = mock (ISdl .class );
3745
@@ -58,11 +66,7 @@ public Void answer(InvocationOnMock invocation) {
5866 lockScreenManager = new LockScreenManager (lockScreenConfig , context , internalInterface );
5967 }
6068
61- @ Override
62- public void tearDown () throws Exception {
63- super .tearDown ();
64- }
65-
69+ @ Test
6670 public void testVariables () {
6771 assertEquals (TestValues .GENERAL_INT , lockScreenManager .customView );
6872 assertEquals (TestValues .GENERAL_INT , lockScreenManager .lockScreenIcon );
@@ -73,48 +77,56 @@ public void testVariables() {
7377 assertEquals (LockScreenConfig .DISPLAY_MODE_OPTIONAL_OR_REQUIRED , lockScreenManager .displayMode );
7478 }
7579
80+ @ Test
7681 public void testGetLockScreenStatusHmiNoneDDOff (){
7782 lockScreenManager .driverDistStatus = false ;
7883 lockScreenManager .hmiLevel = HMILevel .HMI_NONE ;
7984 assertEquals (LockScreenStatus .OFF , lockScreenManager .getLockScreenStatus ());
8085 }
8186
87+ @ Test
8288 public void testGetLockScreenStatusHmiBackgroundDDOff (){
8389 lockScreenManager .driverDistStatus = false ;
8490 lockScreenManager .hmiLevel = HMILevel .HMI_BACKGROUND ;
8591 assertEquals (LockScreenStatus .OFF , lockScreenManager .getLockScreenStatus ());
8692 }
8793
94+ @ Test
8895 public void testGetLockScreenStatusHmiNoneDDOn (){
8996 lockScreenManager .driverDistStatus = true ;
9097 lockScreenManager .hmiLevel = HMILevel .HMI_BACKGROUND ;
9198 assertEquals (LockScreenStatus .REQUIRED , lockScreenManager .getLockScreenStatus ());
9299 }
93100
101+ @ Test
94102 public void testGetLockScreenStatusHmiFullDDOff (){
95103 lockScreenManager .driverDistStatus = false ;
96104 lockScreenManager .hmiLevel = HMILevel .HMI_FULL ;
97105 assertEquals (LockScreenStatus .OPTIONAL , lockScreenManager .getLockScreenStatus ());
98106 }
99107
108+ @ Test
100109 public void testGetLockScreenStatusHmiFullDDOn (){
101110 lockScreenManager .driverDistStatus = true ;
102111 lockScreenManager .hmiLevel = HMILevel .HMI_FULL ;
103112 assertEquals (LockScreenStatus .REQUIRED , lockScreenManager .getLockScreenStatus ());
104113 }
105114
115+ @ Test
106116 public void testGetLockScreenStatusHmiLimitedDDOff (){
107117 lockScreenManager .driverDistStatus = false ;
108118 lockScreenManager .hmiLevel = HMILevel .HMI_LIMITED ;
109119 assertEquals (LockScreenStatus .OPTIONAL , lockScreenManager .getLockScreenStatus ());
110120 }
111121
122+ @ Test
112123 public void testGetLockScreenStatusHmiLimitedDDOn (){
113124 lockScreenManager .driverDistStatus = true ;
114125 lockScreenManager .hmiLevel = HMILevel .HMI_LIMITED ;
115126 assertEquals (LockScreenStatus .REQUIRED , lockScreenManager .getLockScreenStatus ());
116127 }
117128
129+ @ Test
118130 public void testLockScreenDismissibleWithEnableTrueAndDismissibilityTrue (){
119131 lockScreenManager .enableDismissGesture = true ;
120132 OnDriverDistraction onDriverDistraction = new OnDriverDistraction ();
@@ -125,6 +137,7 @@ public void testLockScreenDismissibleWithEnableTrueAndDismissibilityTrue(){
125137 assertTrue (lockScreenManager .mIsLockscreenDismissible );
126138 }
127139
140+ @ Test
128141 public void testLockScreenDismissibleWithEnableFalseAndDismissibilityFalse (){
129142 lockScreenManager .enableDismissGesture = false ;
130143 OnDriverDistraction onDriverDistraction = new OnDriverDistraction ();
@@ -135,6 +148,7 @@ public void testLockScreenDismissibleWithEnableFalseAndDismissibilityFalse(){
135148 assertFalse (lockScreenManager .mIsLockscreenDismissible );
136149 }
137150
151+ @ Test
138152 public void testLockScreenDismissibleWithEnableTrueAndDismissibilityFalse (){
139153 lockScreenManager .enableDismissGesture = true ;
140154 OnDriverDistraction onDriverDistraction = new OnDriverDistraction ();
@@ -145,6 +159,7 @@ public void testLockScreenDismissibleWithEnableTrueAndDismissibilityFalse(){
145159 assertFalse (lockScreenManager .mIsLockscreenDismissible );
146160 }
147161
162+ @ Test
148163 public void testLockScreenDismissibleWithEnableFalseAndDismissibilityTrue (){
149164 lockScreenManager .enableDismissGesture = false ;
150165 OnDriverDistraction onDriverDistraction = new OnDriverDistraction ();
0 commit comments