Search in sources :

Example 1 with BanDetails

use of com.faforever.server.entity.BanDetails in project faf-java-server by FAForever.

the class FafUserDetailsTest method userWithValidBanDetailsIsLocked.

@Test
public void userWithValidBanDetailsIsLocked() throws Exception {
    User user = (User) new User().setPassword(TEST_PASSWORD).setBanDetails(new BanDetails().setExpiresAt(Timestamp.from(Instant.now().plus(1, ChronoUnit.HOURS)))).setLogin(TEST_USERNAME);
    FafUserDetails fafUserDetails = new FafUserDetails(user);
    assertThat(fafUserDetails.isAccountNonLocked(), is(false));
}
Also used : User(com.faforever.server.entity.User) BanDetails(com.faforever.server.entity.BanDetails) Test(org.junit.Test)

Example 2 with BanDetails

use of com.faforever.server.entity.BanDetails in project faf-java-server by FAForever.

the class FafUserDetailsTest method userWithExpiredBanDetailsIsNonLocked.

@Test
public void userWithExpiredBanDetailsIsNonLocked() throws Exception {
    User user = (User) new User().setPassword(TEST_PASSWORD).setBanDetails(new BanDetails().setExpiresAt(Timestamp.from(Instant.now().minusSeconds(1)))).setLogin(TEST_USERNAME);
    FafUserDetails fafUserDetails = new FafUserDetails(user);
    assertThat(fafUserDetails.isAccountNonLocked(), is(true));
}
Also used : User(com.faforever.server.entity.User) BanDetails(com.faforever.server.entity.BanDetails) Test(org.junit.Test)

Aggregations

BanDetails (com.faforever.server.entity.BanDetails)2 User (com.faforever.server.entity.User)2 Test (org.junit.Test)2