Browse Source

added Configuration Menu exit

feature-vault
fdai6352 3 years ago
parent
commit
1c6d2148f2
  1. 11
      src/main/java/Vault.java
  2. 8
      src/test/java/VaultTest.java

11
src/main/java/Vault.java

@ -6,6 +6,7 @@ import java.util.Scanner;
public class Vault implements VaultInterface {
public boolean config;
InputStream inputS = System.in;
OutputStream outputS = System.out;
@ -19,7 +20,8 @@ public class Vault implements VaultInterface {
public void configure(){
StringBuilder sbcm = new StringBuilder();
//Scanner scan = new Scanner(inputS);
Scanner scan = new Scanner(inputS);
config = true;
sbcm.append("Configure:\n");
sbcm.append("- Passwordlength: l\n");
@ -28,6 +30,13 @@ public class Vault implements VaultInterface {
println(sbcm.toString());
String input = scan.nextLine();
if (input.equals("e")) {
config = false;
}
}
public void addCredential(){

8
src/test/java/VaultTest.java

@ -48,6 +48,14 @@ public class VaultTest {
assertTrue(outputStream.toString().startsWith("Configure:"));
}
@Test
void exitConfigurationMenu(){
vlt.inputS = new ByteArrayInputStream("e".getBytes(StandardCharsets.UTF_8));
vlt.configure();
assertFalse(vlt.config);
}
private ByteArrayInputStream getEmptyStringInputStream() {
return new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8));

Loading…
Cancel
Save