Browse Source

refactor list vaults

feature-create-new-vault
binsky 3 years ago
parent
commit
02a62e789b
  1. 3
      src/main/java/PasswordManager.java
  2. 3
      src/test/java/PasswordManagerTest.java

3
src/main/java/PasswordManager.java

@ -38,6 +38,9 @@ public class PasswordManager implements PasswordManagerInterface {
@Override @Override
public void listVaults() { public void listVaults() {
println("Vaults:"); println("Vaults:");
for (int i = 0; i < vaults.size(); i++) {
println("- vault id: " + i);
}
} }
public void createNewVault() { public void createNewVault() {

3
src/test/java/PasswordManagerTest.java

@ -46,7 +46,8 @@ class PasswordManagerTest {
pm.inputStream = new ByteArrayInputStream("l\n".getBytes(StandardCharsets.UTF_8)); pm.inputStream = new ByteArrayInputStream("l\n".getBytes(StandardCharsets.UTF_8));
pm.outputStream = outputStream; pm.outputStream = outputStream;
pm.showMenu(); pm.showMenu();
assertTrue(outputStream.toString().endsWith("Vaults:\n"));
pm.createNewVault();
assertTrue(outputStream.toString().contains("Vaults:\n- vault id: 0\n"));
} }
@Test @Test

Loading…
Cancel
Save