|
@ -47,16 +47,20 @@ public class VaultTest { |
|
|
@Test |
|
|
@Test |
|
|
void openAddCredentialMenuItem() { |
|
|
void openAddCredentialMenuItem() { |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
vlt.inputS = new ByteArrayInputStream("a".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("a\npeter\npassword".getBytes(StandardCharsets.UTF_8)); |
|
|
vlt.outputS = outputStream; |
|
|
vlt.outputS = outputStream; |
|
|
vlt.credentialMenu(); |
|
|
vlt.credentialMenu(); |
|
|
assertTrue(outputStream.toString().contains("Type")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertTrue(outputStream.toString().contains("username")); |
|
|
|
|
|
assertEquals("peter", vlt.userName); |
|
|
|
|
|
assertTrue(outputStream.toString().contains("password")); |
|
|
|
|
|
assertEquals("password",vlt.password); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void openShowCredentialMenuItem() { |
|
|
void openShowCredentialMenuItem() { |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
vlt.inputS = new ByteArrayInputStream("c".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("c\n1".getBytes(StandardCharsets.UTF_8)); |
|
|
vlt.outputS = outputStream; |
|
|
vlt.outputS = outputStream; |
|
|
vlt.credentialMenu(); |
|
|
vlt.credentialMenu(); |
|
|
assertTrue(outputStream.toString().contains("Type")); |
|
|
assertTrue(outputStream.toString().contains("Type")); |
|
@ -65,13 +69,21 @@ public class VaultTest { |
|
|
@Test |
|
|
@Test |
|
|
void openEditCredentialMenuItem() { |
|
|
void openEditCredentialMenuItem() { |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
vlt.inputS = new ByteArrayInputStream("l".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("l\n1\nu\npeter".getBytes(StandardCharsets.UTF_8)); |
|
|
vlt.outputS = outputStream; |
|
|
vlt.outputS = outputStream; |
|
|
vlt.credentialMenu(); |
|
|
vlt.credentialMenu(); |
|
|
assertTrue(outputStream.toString().contains("Type")); |
|
|
assertTrue(outputStream.toString().contains("Type")); |
|
|
|
|
|
assertEquals(1,vlt.newID); |
|
|
|
|
|
assertEquals(true,vlt.decision); |
|
|
|
|
|
assertEquals("peter",vlt.newString); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
|
/*@Test |
|
|
|
|
|
void editCredentialTest() { |
|
|
|
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
/*@Test |
|
|
void addCredentialTest() { |
|
|
void addCredentialTest() { |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
vlt.outputS = outputStream; |
|
|
vlt.outputS = outputStream; |
|
@ -82,25 +94,21 @@ public class VaultTest { |
|
|
assertEquals("peter", vlt.userName); |
|
|
assertEquals("peter", vlt.userName); |
|
|
assertTrue(outputStream.toString().contains("password")); |
|
|
assertTrue(outputStream.toString().contains("password")); |
|
|
assertEquals("password",vlt.password); |
|
|
assertEquals("password",vlt.password); |
|
|
} |
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
|
/*@Test |
|
|
void showCredentialTest() { |
|
|
void showCredentialTest() { |
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
|
|
|
|
|
vlt.outputS = outputStream; |
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("1".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
vlt.showCredential(); |
|
|
|
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("l\n1".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
vlt.credentialMenu(); |
|
|
|
|
|
|
|
|
assertTrue(outputStream.toString().contains("Type")); |
|
|
|
|
|
assertTrue(vlt.isInt); |
|
|
assertTrue(vlt.isInt); |
|
|
|
|
|
|
|
|
vlt.outputS = outputStream; |
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("peter".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
vlt.showCredential(); |
|
|
|
|
|
|
|
|
vlt.inputS = new ByteArrayInputStream("l\npeter".getBytes(StandardCharsets.UTF_8)); |
|
|
|
|
|
vlt.credentialMenu(); |
|
|
|
|
|
|
|
|
assertTrue(outputStream.toString().contains("Type")); |
|
|
|
|
|
assertFalse(vlt.isInt); |
|
|
assertFalse(vlt.isInt); |
|
|
} |
|
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void getAsJson() {vlt.getAsJson();} |
|
|
void getAsJson() {vlt.getAsJson();} |
|
|