Update test coverage
This commit is contained in:
@@ -301,6 +301,27 @@ public class TestRailFence{
|
||||
verify(logger, times(1)).debug("Fence output '{}'", decodedString.replaceAll("[^a-zA-Z]", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecode_length(){
|
||||
cipher.inputString = "aa";
|
||||
cipher.fence = new StringBuilder[]{
|
||||
new StringBuilder(),
|
||||
new StringBuilder(),
|
||||
new StringBuilder()
|
||||
};
|
||||
|
||||
cipher.decode();
|
||||
|
||||
assertEquals("aa", cipher.outputString);
|
||||
verify(logger, times(1)).debug("Decoding");
|
||||
verify(logger, times(1)).debug("Number of characters in the top rail {}", 1);
|
||||
verify(logger, times(1)).debug("Number of characters in the middle rails {}", 1);
|
||||
verify(logger, times(1)).debug("Number of characters in the bottom rail {}", 0);
|
||||
verify(logger, times(1)).debug("Adding characters to the rails");
|
||||
verify(logger, times(1)).debug("Appending the bottom rail");
|
||||
verify(logger, times(1)).debug("Fence output '{}'", "aa");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetters(){
|
||||
cipher.inputString = decodedString;
|
||||
|
||||
@@ -204,7 +204,7 @@ public class TestTrifid{
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetFillIn_nonPrinting(){
|
||||
public void testSetFillIn_nonPrintingLow(){
|
||||
assertThrows(InvalidCharacterException.class, () -> {
|
||||
cipher.setFillIn('\0');
|
||||
});
|
||||
@@ -213,6 +213,16 @@ public class TestTrifid{
|
||||
verify(logger, never()).debug(eq("Setting fill in {}"), anyChar());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetFill_nonPrintingHigh(){
|
||||
assertThrows(InvalidCharacterException.class, () -> {
|
||||
cipher.setFillIn((char)127);
|
||||
});
|
||||
|
||||
assertEquals('+', cipher.fillIn);
|
||||
verify(logger, never()).debug(eq("Setting fill in {}"), anyChar());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetFillIn_letter(){
|
||||
assertThrows(InvalidCharacterException.class, () -> {
|
||||
|
||||
Reference in New Issue
Block a user