From a048e3572c9ff2c49d90c962fe10cf6b786e6439 Mon Sep 17 00:00:00 2001 From: fdai5728 Date: Wed, 16 Feb 2022 17:49:48 +0100 Subject: [PATCH] Updates Interface and function signatures --- src/main/java/CredentialRepository.java | 10 ++++++++-- src/main/java/CredentialRepositoryInterface.java | 4 ++-- src/test/java/CredentialRepositoryTest.java | 13 ++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java index 7b5dab2..a1837f2 100644 --- a/src/main/java/CredentialRepository.java +++ b/src/main/java/CredentialRepository.java @@ -60,13 +60,19 @@ public class CredentialRepository implements CredentialRepositoryInterface{ @Override - public void updatePassword(int index) { + public void updatePassword(int index, String newPassword) { + try{ + + } + catch (IndexOutOfBoundsException outOfBoundsException) + { + } } - public void updateUsername(int index){ + public void updateUsername(int index, String newUsername){ } diff --git a/src/main/java/CredentialRepositoryInterface.java b/src/main/java/CredentialRepositoryInterface.java index da4696c..afff4b0 100644 --- a/src/main/java/CredentialRepositoryInterface.java +++ b/src/main/java/CredentialRepositoryInterface.java @@ -3,8 +3,8 @@ public interface CredentialRepositoryInterface { int createNewCredential(String name, String password); Credential getCredentialsViaName(String needle); Credential getCredentialsViaId(int id); - void updatePassword(int index); - void updateUsername(int index); + void updatePassword(int index, String newPassword); + void updateUsername(int indexl, String newUsername); void delete(int index); } diff --git a/src/test/java/CredentialRepositoryTest.java b/src/test/java/CredentialRepositoryTest.java index 9159b87..7ce26d3 100644 --- a/src/test/java/CredentialRepositoryTest.java +++ b/src/test/java/CredentialRepositoryTest.java @@ -49,13 +49,12 @@ class CredentialRepositoryTest { } -} + @Test + void testUpdatePassword(){ + // this.credentialRepository.createNewCredential("mock", "mock"); + // this.credentialRepository.updatePassword(0); - /* - Exception failed = Assertions.assertThrows(Exception.class, () -> { - this.credentialRepository.createNewCredential(null,null); - }); + } - Assertions.assertEquals("kein leeres Objekt erstellen", failed.getMessage()); - */ \ No newline at end of file +}