From 6b1d22f773ac8582bb6a1bd9273acf734b501c2d Mon Sep 17 00:00:00 2001 From: fdai6352 Date: Wed, 16 Feb 2022 17:15:03 +0100 Subject: [PATCH] added vault configure menu wrong input message --- src/main/java/Vault.java | 2 ++ src/test/java/VaultTest.java | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/Vault.java b/src/main/java/Vault.java index 0bd630b..4c3de46 100644 --- a/src/main/java/Vault.java +++ b/src/main/java/Vault.java @@ -39,6 +39,8 @@ public class Vault implements VaultInterface { if (input.equals("e")) { config = false; + }else if (!input.equals("l")|!input.equals("l")|!input.equals("l")) { + println("Please enter valid key."); } } diff --git a/src/test/java/VaultTest.java b/src/test/java/VaultTest.java index a4e95ec..00642ab 100644 --- a/src/test/java/VaultTest.java +++ b/src/test/java/VaultTest.java @@ -79,6 +79,16 @@ public class VaultTest { assertTrue(outputStream.toString().startsWith("Configure:")); } + @Test + void configureMenuWrongInputMessage() { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + vlt.inputS = new ByteArrayInputStream("__\n".getBytes(StandardCharsets.UTF_8)); + vlt.outputS = outputStream; + vlt.configure(); + assertTrue(outputStream.toString().contains("Please")); + } + + @Test void openSetPWLength() { ByteArrayOutputStream outputStream = new ByteArrayOutputStream();