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]", ""));
|
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
|
@Test
|
||||||
public void testGetters(){
|
public void testGetters(){
|
||||||
cipher.inputString = decodedString;
|
cipher.inputString = decodedString;
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public class TestTrifid{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetFillIn_nonPrinting(){
|
public void testSetFillIn_nonPrintingLow(){
|
||||||
assertThrows(InvalidCharacterException.class, () -> {
|
assertThrows(InvalidCharacterException.class, () -> {
|
||||||
cipher.setFillIn('\0');
|
cipher.setFillIn('\0');
|
||||||
});
|
});
|
||||||
@@ -213,6 +213,16 @@ public class TestTrifid{
|
|||||||
verify(logger, never()).debug(eq("Setting fill in {}"), anyChar());
|
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
|
@Test
|
||||||
public void testSetFillIn_letter(){
|
public void testSetFillIn_letter(){
|
||||||
assertThrows(InvalidCharacterException.class, () -> {
|
assertThrows(InvalidCharacterException.class, () -> {
|
||||||
|
|||||||
Reference in New Issue
Block a user