|
|
@ -72,11 +72,23 @@ public class VaultTest { |
|
|
|
@Test |
|
|
|
void openSetPWLength() { |
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
vlt.inputS = new ByteArrayInputStream("12".getBytes(StandardCharsets.UTF_8)); |
|
|
|
vlt.outputS = outputStream; |
|
|
|
vlt.setPWLength(); |
|
|
|
assertTrue(outputStream.toString().startsWith("Set")); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void setPWLength() { |
|
|
|
vlt.inputS = new ByteArrayInputStream("7\n".getBytes(StandardCharsets.UTF_8)); |
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
vlt.outputS = outputStream; |
|
|
|
vlt.setPWLength(); |
|
|
|
|
|
|
|
assertEquals(7, vlt.PWLength); |
|
|
|
assertTrue(outputStream.toString().contains("now:")); |
|
|
|
} |
|
|
|
|
|
|
|
private ByteArrayInputStream getEmptyStringInputStream() { |
|
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
|
} |
|
|
|