Skip to content

Commit

Permalink
Fix unit test for deleteUser call in InMemoryUserManagerTests
Browse files Browse the repository at this point in the history
  • Loading branch information
besidev committed Jan 8, 2024
1 parent e090899 commit e8964f2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

import static one.jpro.platform.auth.core.utils.AuthUtils.BCRYPT_PASSWORD_ENCODER;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

/**
* In memory UserManager tests.
Expand Down Expand Up @@ -59,8 +59,9 @@ public void testDeleteUser() throws ExecutionException, InterruptedException {
final User user = userManager.loadUserByUsername("someuser").get();
assertThat(user.getName()).isEqualTo("someuser");
userManager.deleteUser("someuser").get();
assertThatExceptionOfType(UserNotFoundException.class)
.isThrownBy(() -> userManager.loadUserByUsername("someuser").get());
assertThat(userManager.loadUserByUsername("someuser")).failsWithin(1, TimeUnit.SECONDS)
.withThrowableThat().havingRootCause().isInstanceOf(UserNotFoundException.class)
.withMessage("User does not exist: someuser");
}

@Test
Expand Down

0 comments on commit e8964f2

Please sign in to comment.