|
@ -89,6 +89,19 @@ public class VaultTest { |
|
|
assertTrue(outputStream.toString().contains("now:")); |
|
|
assertTrue(outputStream.toString().contains("now:")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void setPWLengthWrongInput() { |
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("T\n".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
vlt.setPWLength(); |
|
|
|
|
|
|
|
|
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
vlt.inputS = getEmptyStringInputStream(); |
|
|
|
|
|
vlt.outputS = outputStream; |
|
|
|
|
|
|
|
|
|
|
|
assertThrowsExactly(NoSuchElementException.class, () -> vlt.setPWLength()); |
|
|
|
|
|
assertTrue(outputStream.toString().startsWith("Set")); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private ByteArrayInputStream getEmptyStringInputStream() { |
|
|
private ByteArrayInputStream getEmptyStringInputStream() { |
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
} |
|
|
} |
|
|