Use diamond type
This commit is contained in:
@@ -104,7 +104,7 @@ public class DefaultSpringSecurityContextSourceTests extends AbstractLdapIntegra
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void instantiationFailsWithEmptyServerList() throws Exception {
|
||||
List<String> serverUrls = new ArrayList<String>();
|
||||
List<String> serverUrls = new ArrayList<>();
|
||||
DefaultSpringSecurityContextSource ctxSrc = new DefaultSpringSecurityContextSource(
|
||||
serverUrls, "dc=springframework,dc=org");
|
||||
ctxSrc.afterPropertiesSet();
|
||||
@@ -112,7 +112,7 @@ public class DefaultSpringSecurityContextSourceTests extends AbstractLdapIntegra
|
||||
|
||||
@Test
|
||||
public void instantiationSuceedsWithProperServerList() throws Exception {
|
||||
List<String> serverUrls = new ArrayList<String>();
|
||||
List<String> serverUrls = new ArrayList<>();
|
||||
serverUrls.add("ldap://foo:789");
|
||||
serverUrls.add("ldap://bar:389");
|
||||
serverUrls.add("ldaps://blah:636");
|
||||
@@ -127,7 +127,7 @@ public class DefaultSpringSecurityContextSourceTests extends AbstractLdapIntegra
|
||||
@Test
|
||||
public void instantiationSuceedsWithEmtpyBaseDn() throws Exception {
|
||||
String baseDn = "";
|
||||
List<String> serverUrls = new ArrayList<String>();
|
||||
List<String> serverUrls = new ArrayList<>();
|
||||
serverUrls.add("ldap://foo:789");
|
||||
serverUrls.add("ldap://bar:389");
|
||||
serverUrls.add("ldaps://blah:636");
|
||||
@@ -140,7 +140,7 @@ public class DefaultSpringSecurityContextSourceTests extends AbstractLdapIntegra
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void instantiationFailsWithIncorrectServerUrl() throws Exception {
|
||||
List<String> serverUrls = new ArrayList<String>();
|
||||
List<String> serverUrls = new ArrayList<>();
|
||||
// a simple trailing slash should be ok
|
||||
serverUrls.add("ldaps://blah:636/");
|
||||
// this url should be rejected because the root DN goes into a separate parameter
|
||||
|
||||
@@ -185,7 +185,7 @@ public class SpringSecurityLdapTemplateITests extends AbstractLdapIntegrationTes
|
||||
|
||||
@Test
|
||||
public void nonSpringLdapSearchCodeTestMethod() throws Exception {
|
||||
java.util.Hashtable<String, String> env = new java.util.Hashtable<String, String>();
|
||||
java.util.Hashtable<String, String> env = new java.util.Hashtable<>();
|
||||
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
|
||||
env.put(Context.PROVIDER_URL, "ldap://localhost:"
|
||||
+ ApacheDSServerIntegrationTests.getServerPort());
|
||||
|
||||
@@ -114,7 +114,7 @@ public class BindAuthenticatorTests extends AbstractLdapIntegrationTests {
|
||||
|
||||
/*
|
||||
* @Test public void messingWithEscapedChars() throws Exception {
|
||||
* Hashtable<String,String> env = new Hashtable<String,String>();
|
||||
* Hashtable<String,String> env = new Hashtable<>();
|
||||
* env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
|
||||
* env.put(Context.PROVIDER_URL, "ldap://127.0.0.1:22389/dc=springsource,dc=com");
|
||||
* env.put(Context.SECURITY_AUTHENTICATION, "simple");
|
||||
|
||||
@@ -196,8 +196,8 @@ public class ApacheDSContainerTests {
|
||||
}
|
||||
|
||||
private List<Integer> getDefaultPorts(int count) throws IOException {
|
||||
List<ServerSocket> connections = new ArrayList<ServerSocket>();
|
||||
List<Integer> availablePorts = new ArrayList<Integer>(count);
|
||||
List<ServerSocket> connections = new ArrayList<>();
|
||||
List<Integer> availablePorts = new ArrayList<>(count);
|
||||
try {
|
||||
for (int i = 0; i < count; i++) {
|
||||
ServerSocket socket = new ServerSocket(0);
|
||||
|
||||
@@ -46,8 +46,8 @@ public class UnboundIdContainerTests {
|
||||
}
|
||||
|
||||
private List<Integer> getDefaultPorts(int count) throws IOException {
|
||||
List<ServerSocket> connections = new ArrayList<ServerSocket>();
|
||||
List<Integer> availablePorts = new ArrayList<Integer>(count);
|
||||
List<ServerSocket> connections = new ArrayList<>();
|
||||
List<Integer> availablePorts = new ArrayList<>(count);
|
||||
try {
|
||||
for (int i = 0; i < count; i++) {
|
||||
ServerSocket socket = new ServerSocket(0);
|
||||
|
||||
@@ -147,7 +147,7 @@ public class DefaultLdapAuthoritiesPopulatorTests extends AbstractLdapIntegratio
|
||||
@Override
|
||||
protected Set<GrantedAuthority> getAdditionalRoles(DirContextOperations user,
|
||||
String username) {
|
||||
return new HashSet<GrantedAuthority>(
|
||||
return new HashSet<>(
|
||||
AuthorityUtils.createAuthorityList("ROLE_EXTRA"));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user