refactor: AssertJ best practices
Use this link to re-run the recipe: https://app.moderne.io/recipes/builder/bGVuS?organizationId=RGVmYXVsdA%3D%3D Co-authored-by: Moderne <team@moderne.io>
This commit is contained in:
committed by
Josh Cummings
parent
36a488a360
commit
9df9cb5aed
@@ -46,7 +46,7 @@ public class InetOrgPersonTests {
|
||||
InetOrgPerson p2 = (InetOrgPerson) essence.createUserDetails();
|
||||
Set<InetOrgPerson> set = new HashSet<>();
|
||||
set.add(p);
|
||||
assertThat(set.contains(p2)).isTrue();
|
||||
assertThat(set).contains(p2);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -60,7 +60,7 @@ public class LdapUserDetailsServiceTests {
|
||||
UserDetails user = service.loadUserByUsername("doesntmatterwegetjoeanyway");
|
||||
Set<String> authorities = AuthorityUtils.authorityListToSet(user.getAuthorities());
|
||||
assertThat(authorities).hasSize(1);
|
||||
assertThat(authorities.contains("ROLE_FROM_POPULATOR")).isTrue();
|
||||
assertThat(authorities).contains("ROLE_FROM_POPULATOR");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -47,7 +47,7 @@ public class UserDetailsServiceLdapAuthoritiesPopulatorTests {
|
||||
UserDetailsServiceLdapAuthoritiesPopulator populator = new UserDetailsServiceLdapAuthoritiesPopulator(uds);
|
||||
Collection<? extends GrantedAuthority> auths = populator.getGrantedAuthorities(new DirContextAdapter(), "joe");
|
||||
assertThat(auths).hasSize(1);
|
||||
assertThat(AuthorityUtils.authorityListToSet(auths).contains("ROLE_USER")).isTrue();
|
||||
assertThat(AuthorityUtils.authorityListToSet(auths)).contains("ROLE_USER");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user