Use diamond type
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public final class TestSecurityContextHolder {
|
||||
|
||||
private static final ThreadLocal<SecurityContext> contextHolder = new ThreadLocal<SecurityContext>();
|
||||
private static final ThreadLocal<SecurityContext> contextHolder = new ThreadLocal<>();
|
||||
|
||||
/**
|
||||
* Clears the {@link SecurityContext} from {@link TestSecurityContextHolder} and
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ final class WithMockUserSecurityContextFactory implements
|
||||
+ " cannot have null username on both username and value properites");
|
||||
}
|
||||
|
||||
List<GrantedAuthority> grantedAuthorities = new ArrayList<GrantedAuthority>();
|
||||
List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
|
||||
for (String authority : withUser.authorities()) {
|
||||
grantedAuthorities.add(new SimpleGrantedAuthority(authority));
|
||||
}
|
||||
@@ -71,4 +71,4 @@ final class WithMockUserSecurityContextFactory implements
|
||||
context.setAuthentication(authentication);
|
||||
return context;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -796,7 +796,7 @@ public final class SecurityMockMvcRequestPostProcessors {
|
||||
* @return the UserRequestPostProcessor for further customizations
|
||||
*/
|
||||
public UserRequestPostProcessor roles(String... roles) {
|
||||
List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(
|
||||
List<GrantedAuthority> authorities = new ArrayList<>(
|
||||
roles.length);
|
||||
for (String role : roles) {
|
||||
if (role.startsWith(ROLE_PREFIX)) {
|
||||
|
||||
+2
-2
@@ -213,7 +213,7 @@ public final class SecurityMockMvcResultMatchers {
|
||||
* @return the {@link AuthenticatedMatcher} for further customization
|
||||
*/
|
||||
public AuthenticatedMatcher withRoles(String... roles) {
|
||||
Collection<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
|
||||
Collection<GrantedAuthority> authorities = new ArrayList<>();
|
||||
for (String role : roles) {
|
||||
authorities.add(new SimpleGrantedAuthority("ROLE_" + role));
|
||||
}
|
||||
@@ -251,4 +251,4 @@ public final class SecurityMockMvcResultMatchers {
|
||||
|
||||
private SecurityMockMvcResultMatchers() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user