From 18f4cc93f9ebfcb6e36a186b5825ed460605fa60 Mon Sep 17 00:00:00 2001 From: fdai6352 Date: Thu, 17 Feb 2022 01:51:41 +0100 Subject: [PATCH] implemented show credential via name functionality --- src/main/java/Vault.java | 3 +++ src/test/java/VaultTest.java | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/Vault.java b/src/main/java/Vault.java index e504a64..2f07ec7 100644 --- a/src/main/java/Vault.java +++ b/src/main/java/Vault.java @@ -94,6 +94,9 @@ public class Vault implements VaultInterface { if(str.matches("[0-9]+")) { isInt = true; //getCredentialsViaId(Integer.parseInt(str)); + } else { + isInt = false; + //getCredentialsViaName(str); } } diff --git a/src/test/java/VaultTest.java b/src/test/java/VaultTest.java index 0116dc1..787c6ba 100644 --- a/src/test/java/VaultTest.java +++ b/src/test/java/VaultTest.java @@ -93,6 +93,13 @@ public class VaultTest { assertTrue(outputStream.toString().contains("Type")); assertTrue(vlt.isInt); + + vlt.outputS = outputStream; + vlt.inputS = new ByteArrayInputStream("peter".getBytes(StandardCharsets.UTF_8)); + vlt.showCredential(); + + assertTrue(outputStream.toString().contains("Type")); + assertFalse(vlt.isInt); } @Test