From 2ad4ea87c4e68874d61049adb20963c8cf85a1e2 Mon Sep 17 00:00:00 2001 From: fdai5728 Date: Wed, 16 Feb 2022 17:53:56 +0100 Subject: [PATCH] Implements function for Username Update --- src/main/java/CredentialRepository.java | 7 +++++++ src/test/java/CredentialRepositoryTest.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/CredentialRepository.java b/src/main/java/CredentialRepository.java index 58122d5..1a331c7 100644 --- a/src/main/java/CredentialRepository.java +++ b/src/main/java/CredentialRepository.java @@ -74,6 +74,13 @@ public class CredentialRepository implements CredentialRepositoryInterface{ public void updateUsername(int index, String newUsername){ + try{ + this.credentials.get(index).updateUsername(newUsername); + } + catch (IndexOutOfBoundsException outOfBoundsException) + { + + } } @Override diff --git a/src/test/java/CredentialRepositoryTest.java b/src/test/java/CredentialRepositoryTest.java index dcd87a5..b7b0674 100644 --- a/src/test/java/CredentialRepositoryTest.java +++ b/src/test/java/CredentialRepositoryTest.java @@ -69,7 +69,7 @@ class CredentialRepositoryTest { Credential c = this.credentialRepository.getCredentialsViaId(0); - Assertions.assertEquals("newPassword", c.getName()); + Assertions.assertEquals("newUsername", c.getName()); }