Skip to content

Commit

Permalink
Fixed bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
FabriDeCastelli committed Aug 9, 2023
1 parent 26bcf32 commit b79db39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/server/controller/RequestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void register(@NotNull User user) {
serverResponse = new ServerResponse(-1, "Registration failed.");
}

if (sendResponse(serverResponse)) {
if (!sendResponse(serverResponse)) {
throw new IllegalStateException("Cannot send response to client.");
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/service/AuthenticationServiceTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import client.service.PasswordHashingService;
import java.util.Optional;
import model.User;
import org.junit.jupiter.api.BeforeAll;
Expand Down Expand Up @@ -75,7 +76,7 @@ public void testAddAlreadyRegisteredUser() {
assertThrows(
IllegalArgumentException.class,
() -> authenticationService.add(
new User("fabry", "fabry")));
new User("f", PasswordHashingService.getInstance().hashPassword("f"))));
}
}

Expand Down

0 comments on commit b79db39

Please sign in to comment.