|
|
@ -110,21 +110,26 @@ public class VaultTest { |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void setCapital() { |
|
|
|
vlt.inputS = new ByteArrayInputStream("yes\n".getBytes(StandardCharsets.UTF_8)); |
|
|
|
void openSetCapitalsMenuItem() { |
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
vlt.inputS = new ByteArrayInputStream("h\nyes".getBytes(StandardCharsets.UTF_8)); |
|
|
|
vlt.outputS = outputStream; |
|
|
|
vlt.setCapital(); |
|
|
|
vlt.configure(); |
|
|
|
assertTrue(vlt.haveCapitals = true); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
void setCapitals() { |
|
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
vlt.outputS = outputStream; |
|
|
|
vlt.setCapital("yes"); |
|
|
|
|
|
|
|
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(); |
|
|
|
vlt.setCapital("no"); |
|
|
|
|
|
|
|
assertTrue(outputStream.toString().startsWith("Should")); |
|
|
|
assertFalse(vlt.haveCapitals = false); |
|
|
|
assertTrue(outputStream.toString().contains("don´t")); |
|
|
|
} |
|
|
|