aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-03-17 16:08:11 -0400
committersowgro <tpoke.ferrari@gmail.com>2025-03-17 16:08:11 -0400
commit251f30c402700169213ed4560a7797a785a50e78 (patch)
treecbc658e4de18d7f6b2c6957a352fb4bfb871c7a6 /ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java
parent4d9fe6c96f487d75a03e3a680cc80fa3f2ad5e4f (diff)
downloadJellySolutions-251f30c402700169213ed4560a7797a785a50e78.tar.gz
JellySolutions-251f30c402700169213ed4560a7797a785a50e78.tar.bz2
JellySolutions-251f30c402700169213ed4560a7797a785a50e78.zip
Refactoring
Diffstat (limited to 'ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java')
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java
index efe639e..3f110cb 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/UserControllerTest.java
@@ -37,8 +37,8 @@ public class UserControllerTest {
public void testGetUser() throws IOException { // getUser may throw IOException
// Setup
String username = "Test";
- User user = new User(username);
- String key = UserAuth.generate(username).getKey();
+ User user = User.create(username, "pass");
+ String key = UserAuth.generate(username).getKey( );
// When the same id is passed in, our mock User DAO will return the User object
when(mockUserService.getUser(username)).thenReturn(user);
@@ -89,7 +89,7 @@ public class UserControllerTest {
// Setup
String username = "Test";
String password = "Pass";
- User user = new User(username);
+ User user = User.create(username, "pass");
// when createUser is called, return true simulating successful
// creation and save
when(mockUserService.createUser(username, password)).thenReturn(user);
@@ -153,7 +153,7 @@ public class UserControllerTest {
public void testUpdateUser() throws IOException { // updateUser may throw IOException
// Setup
String username = "Test";
- User user = new User("Bob");
+ User user = User.create("Bob", "pass");
String key = UserAuth.generate(username).getKey();
// when updateUser is called, return true simulating successful
// update and save
@@ -171,7 +171,7 @@ public class UserControllerTest {
public void testUpdateUserFailed() throws IOException { // updateUser may throw IOException
// Setup
String username = "Test";
- User user = new User("Bob");
+ User user = User.create("Bob", "pass");
String key = UserAuth.generate(username).getKey();
// when updateUser is called, return true simulating successful
// update and save
@@ -188,7 +188,7 @@ public class UserControllerTest {
public void testUpdateUserHandleException() throws IOException { // updateUser may throw IOException
// Setup
String username = "Test";
- User user = new User("Bob");
+ User user = User.create("Bob", "pass");
String key = UserAuth.generate(username).getKey();
// When updateUser is called on the Mock User DAO, throw an IOException
doThrow(new IOException()).when(mockUserService).updateUser(user, username);