aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-03-25 10:17:55 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-03-25 10:17:55 -0400
commit5f03e80712f7a18370b5118fde5327bde1b6fbbf (patch)
tree17ff94c8ba74ab2bfe6195cb6dc6ca06e71f2ea3 /ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java
parent9aa8a8e80caaad9196752e2e101525a584f35a08 (diff)
downloadJellySolutions-5f03e80712f7a18370b5118fde5327bde1b6fbbf.tar.gz
JellySolutions-5f03e80712f7a18370b5118fde5327bde1b6fbbf.tar.bz2
JellySolutions-5f03e80712f7a18370b5118fde5327bde1b6fbbf.zip
Fix tests and more cleanup
Diffstat (limited to 'ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java')
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java
index 55cf7a9..d3085e5 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/service/AuthServiceTest.java
@@ -11,7 +11,6 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-import com.ufund.api.ufundapi.DuplicateKeyException;
import com.ufund.api.ufundapi.model.User;
import com.ufund.api.ufundapi.model.UserAuth;
import com.ufund.api.ufundapi.persistence.UserAuthDAO;
@@ -51,16 +50,16 @@ public class AuthServiceTest {
}
-// @Test
-// public void testAuthenticateMismatchName() throws IOException {
-// // Mock
-// when(mockAuthDAO.getUserAuth(key)).thenReturn(new UserAuth(key, "EvilFish", null));
-// when(mockUserService.getUser("EvilFish")).thenReturn(user);
-//
-// // Analyze
-// assertThrows(IllegalAccessException.class, () -> authService.authenticate(username, key));
-//
-// }
+ @Test
+ public void testAuthenticateMismatchName() throws IOException {
+ // Mock
+ when(mockAuthDAO.getUserAuth(key)).thenReturn(new UserAuth(key, "EvilFish", null));
+ when(mockUserService.getUser("EvilFish")).thenReturn(user);
+
+ // Analyze
+ assertThrows(IllegalAccessException.class, () -> authService.authenticate(username, key));
+
+ }
@Test
public void testAuthenticateMissingUserAuth() throws IOException {
@@ -73,7 +72,7 @@ public class AuthServiceTest {
}
@Test
- public void testLogin() throws IOException, DuplicateKeyException, IllegalAccessException {
+ public void testLogin() throws IOException {
// Mock
when(mockUserService.getUser(username)).thenReturn(user);
@@ -83,7 +82,7 @@ public class AuthServiceTest {
}
@Test
- public void testLoginNullUser() throws IOException, DuplicateKeyException, IllegalAccessException {
+ public void testLoginNullUser() throws IOException {
// Mock
when(mockUserService.getUser(username)).thenReturn(null);
@@ -92,7 +91,7 @@ public class AuthServiceTest {
}
@Test
- public void testLoginMismatchPasswords() throws IOException, DuplicateKeyException, IllegalAccessException {
+ public void testLoginMismatchPasswords() throws IOException {
// Mock
when(mockUserService.getUser(username)).thenReturn(User.create(username, "fries"));
@@ -101,7 +100,7 @@ public class AuthServiceTest {
}
@Test
- public void testLogout() throws IOException, DuplicateKeyException, IllegalAccessException {
+ public void testLogout() {
// Analyze
assertDoesNotThrow(() -> authService.logout(key));