diff --git a/src/main/java/PasswordManager.java b/src/main/java/PasswordManager.java index 97c4711..0a16d66 100644 --- a/src/main/java/PasswordManager.java +++ b/src/main/java/PasswordManager.java @@ -1,7 +1,14 @@ +import java.io.BufferedInputStream; +import java.io.InputStream; + public class PasswordManager implements PasswordManagerInterface { public static void main(String[] args) { PasswordManager pm = new PasswordManager(); - pm.showMenu(); + + while (true) { + InputStream inputStream = System.in; + pm.showMenu(inputStream); + } } public PasswordManager() { @@ -19,7 +26,7 @@ public class PasswordManager implements PasswordManagerInterface { } @Override - public void showMenu() { + public void showMenu(InputStream inputStream) { } } diff --git a/src/main/java/PasswordManagerInterface.java b/src/main/java/PasswordManagerInterface.java index 385532f..bd8421a 100644 --- a/src/main/java/PasswordManagerInterface.java +++ b/src/main/java/PasswordManagerInterface.java @@ -1,7 +1,9 @@ +import java.io.InputStream; + public interface PasswordManagerInterface { public static void main(String[] args) { }; public void listVaults(); public void openVault(); - public void showMenu(); + public void showMenu(InputStream inputStream); } diff --git a/src/test/java/PasswordManagerTest.java b/src/test/java/PasswordManagerTest.java index b18cf0d..7f3bc47 100644 --- a/src/test/java/PasswordManagerTest.java +++ b/src/test/java/PasswordManagerTest.java @@ -1,6 +1,10 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.nio.charset.StandardCharsets; + import static org.junit.jupiter.api.Assertions.*; @@ -30,6 +34,6 @@ class PasswordManagerTest { @Test void showMenu() { - pm.showMenu(); + pm.showMenu(new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8))); } }