|
@ -102,6 +102,26 @@ public class VaultTest { |
|
|
assertTrue(outputStream.toString().startsWith("Set")); |
|
|
assertTrue(outputStream.toString().startsWith("Set")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void setCapital() { |
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("yes\n".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
vlt.outputS = outputStream; |
|
|
|
|
|
vlt.setCapital(); |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(outputStream.toString().startsWith("Should")); |
|
|
|
|
|
assertTrue(vlt.haveCapitals = true); |
|
|
|
|
|
assertTrue(outputStream.toString().contains("contain")); |
|
|
|
|
|
|
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("no\n".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
vlt.outputS = outputStream; |
|
|
|
|
|
vlt.setCapital(); |
|
|
|
|
|
|
|
|
|
|
|
assertTrue(outputStream.toString().startsWith("Should")); |
|
|
|
|
|
assertFalse(vlt.haveCapitals = false); |
|
|
|
|
|
assertTrue(outputStream.toString().contains("don´t")); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private ByteArrayInputStream getEmptyStringInputStream() { |
|
|
private ByteArrayInputStream getEmptyStringInputStream() { |
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8)); |
|
|
} |
|
|
} |
|
|