|
@ -72,11 +72,23 @@ public class VaultTest { |
|
|
@Test |
|
|
@Test |
|
|
void openSetPWLength() { |
|
|
void openSetPWLength() { |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("12".getBytes(StandardCharsets.UTF_8)); |
|
|
vlt.outputS = outputStream; |
|
|
vlt.outputS = outputStream; |
|
|
vlt.setPWLength(); |
|
|
vlt.setPWLength(); |
|
|
assertTrue(outputStream.toString().startsWith("Set")); |
|
|
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() { |
|
|
private ByteArrayInputStream getEmptyStringInputStream() { |
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
} |
|
|
} |
|
|