Skip to content

Commit

Permalink
Create getState test
Browse files Browse the repository at this point in the history
  • Loading branch information
nihas101 committed Mar 8, 2018
1 parent 4c47ec6 commit 682f21a
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,27 @@ public void getMemory() {
assertEquals(false, aBoolean);
}

@Test
public void getStateTest() {
int skipScreenMemoryString = 14;
ScreenMemory screenMemory = new ScreenMemory();
String screenMemoryState = screenMemory.getState();
String screenMemoryString = screenMemoryState.substring(skipScreenMemoryString).trim();

checkForZeroes(screenMemoryString.split("\\s+"));
}

@Test
public void toStringTest() {
String zero = "0";
ScreenMemory screenMemory = new ScreenMemory();
String[] screenMemoryStrings = screenMemory.toString().trim().split("\\s+");

checkForZeroes(screenMemoryStrings);
}

private void checkForZeroes(String[] screenMemoryStrings) {
String zero = "0";

for (String screenMemoryString : screenMemoryStrings)
assertEquals(zero, screenMemoryString.trim());
}
Expand Down

0 comments on commit 682f21a

Please sign in to comment.