|
33 | 33 | import com.smartdevicelink.proxy.rpc.listeners.OnRPCNotificationListener; |
34 | 34 | import com.smartdevicelink.test.Validator; |
35 | 35 |
|
36 | | -import org.junit.Assert; |
37 | 36 | import org.junit.Before; |
38 | 37 | import org.junit.Test; |
39 | 38 | import org.junit.runner.RunWith; |
|
58 | 57 | import static org.mockito.Mockito.mock; |
59 | 58 | import static org.mockito.Mockito.when; |
60 | 59 |
|
61 | | -import android.database.sqlite.SQLiteCantOpenDatabaseException; |
62 | | - |
63 | 60 | /** |
64 | 61 | * This is a unit test class for the SmartDeviceLink library manager class : |
65 | 62 | * {@link SoftButtonManager} |
66 | 63 | */ |
67 | 64 | @RunWith(AndroidJUnit4.class) |
68 | | -//@RunWith(JUnit4.class) |
69 | 65 | public class SoftButtonManagerTests { |
70 | 66 |
|
71 | 67 | private SoftButtonManager softButtonManager; |
@@ -414,48 +410,55 @@ public void testSoftButtonStateEquals() { |
414 | 410 | @Test |
415 | 411 | public void testConstructSoftButtonObjectWithEmptyStateList() { |
416 | 412 | List<SoftButtonState> stateList = new ArrayList<>(); |
417 | | - SoftButtonObject softButtonObject1 = new SoftButtonObject("hello_there", stateList, "general_kenobi", null); |
418 | | - assertNull(softButtonObject1.getStates()); |
| 413 | + SoftButtonObject softButtonObject = new SoftButtonObject("hello_there", stateList, "general_kenobi", null); |
| 414 | + assertNull(softButtonObject.getStates()); |
419 | 415 | } |
420 | 416 |
|
421 | 417 | /** |
422 | 418 | * Test constructing SoftButtonObject with an nonempty state list |
423 | 419 | */ |
424 | 420 | @Test |
425 | | - public void testConstructingSoftButtonObjectWithNonEmptyStateList() { |
| 421 | + public void testConstructSoftButtonObjectWithNonEmptyStateList() { |
426 | 422 | List<SoftButtonState> stateList = new ArrayList<>(); |
427 | 423 | SoftButtonState softButtonState = new SoftButtonState("general_kenobi", "General Kenobi", null); |
428 | 424 | stateList.add(softButtonState); |
429 | | - SoftButtonObject softButtonObject2 = new SoftButtonObject("hello_there_again", stateList, "general_kenobi", null); |
430 | | - assertEquals(stateList, softButtonObject2.getStates()); |
| 425 | + SoftButtonObject softButtonObject = new SoftButtonObject("hello_there", stateList, "general_kenobi", null); |
| 426 | + assertEquals(stateList, softButtonObject.getStates()); |
431 | 427 | } |
432 | 428 |
|
433 | 429 | /** |
434 | 430 | * Test assigning an empty state list to existing SoftButtonObject |
435 | 431 | */ |
436 | 432 | @Test |
437 | 433 | public void testAssignEmptyStateListToSoftButtonObject() { |
438 | | - List<SoftButtonState> stateList = new ArrayList<>(); |
439 | | - SoftButtonState softButtonState = new SoftButtonState("object1-state1", "o1s1", null); |
| 434 | + List<SoftButtonState> nonEmptyStateList = new ArrayList<>(); |
| 435 | + List<SoftButtonState> emptyStateList = new ArrayList<>(); |
| 436 | + SoftButtonState softButtonState = new SoftButtonState("general_kenobi", "General Kenobi", null); |
| 437 | + nonEmptyStateList.add(softButtonState); |
440 | 438 |
|
441 | | - SoftButtonObject softButtonObject = new SoftButtonObject("hi", softButtonState, null); |
| 439 | + SoftButtonObject softButtonObject = new SoftButtonObject("hello_there", nonEmptyStateList, "general_kenobi", null); |
442 | 440 |
|
443 | | - softButtonObject.setStates(stateList); |
444 | | - assertNotEquals(stateList, softButtonObject.getStates()); |
| 441 | + softButtonObject.setStates(emptyStateList); |
| 442 | + assertEquals(nonEmptyStateList, softButtonObject.getStates()); |
445 | 443 | } |
446 | 444 |
|
447 | 445 | /** |
448 | 446 | * Test assigning a nonempty state list to existing SoftButtonObject |
449 | 447 | */ |
450 | 448 | @Test |
451 | 449 | public void testAssignNonEmptyStateListToSoftButtonObject() { |
452 | | - List<SoftButtonState> stateList = new ArrayList<>(); |
453 | | - SoftButtonState softButtonState = new SoftButtonState("object1-state1", "o1s1", null); |
| 450 | + List<SoftButtonState> stateList1 = new ArrayList<>(); |
| 451 | + SoftButtonState softButtonState1 = new SoftButtonState("hello_there", "Hello there", null); |
| 452 | + stateList1.add(softButtonState1); |
454 | 453 |
|
455 | | - SoftButtonObject softButtonObject = new SoftButtonObject("hi", softButtonState, null); |
| 454 | + List<SoftButtonState> stateList2 = new ArrayList<>(); |
| 455 | + SoftButtonState softButtonState2 = new SoftButtonState("general_kenobi", "General Kenobi", null); |
| 456 | + stateList2.add(softButtonState2); |
456 | 457 |
|
457 | | - stateList.add(softButtonState); |
458 | | - softButtonObject.setStates(stateList); |
459 | | - assertEquals(stateList, softButtonObject.getStates()); |
| 458 | + SoftButtonObject softButtonObject = new SoftButtonObject("general_kenobi", stateList1, "general_kenobi", null); |
| 459 | + |
| 460 | + softButtonObject.setStates(stateList2); |
| 461 | + |
| 462 | + assertEquals(stateList2, softButtonObject.getStates()); |
460 | 463 | } |
461 | 464 | } |
0 commit comments