Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests {
|
||||
|
||||
@Test
|
||||
public void testOverridingSameClassDefinedForMapping() {
|
||||
BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<Person>(Person.class);
|
||||
BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<>(Person.class);
|
||||
mapper.setMappedClass(Person.class);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests {
|
||||
Mock mock = new Mock();
|
||||
List<Person> result = mock.getJdbcTemplate().query(
|
||||
"select name, age, birth_date, balance from people",
|
||||
new BeanPropertyRowMapper<Person>(Person.class));
|
||||
new BeanPropertyRowMapper<>(Person.class));
|
||||
assertEquals(1, result.size());
|
||||
verifyPerson(result.get(0));
|
||||
mock.verifyClosed();
|
||||
@@ -70,7 +70,7 @@ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests {
|
||||
Mock mock = new Mock();
|
||||
List<ConcretePerson> result = mock.getJdbcTemplate().query(
|
||||
"select name, age, birth_date, balance from people",
|
||||
new BeanPropertyRowMapper<ConcretePerson>(ConcretePerson.class));
|
||||
new BeanPropertyRowMapper<>(ConcretePerson.class));
|
||||
assertEquals(1, result.size());
|
||||
verifyConcretePerson(result.get(0));
|
||||
mock.verifyClosed();
|
||||
@@ -81,7 +81,7 @@ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests {
|
||||
Mock mock = new Mock();
|
||||
List<ConcretePerson> result = mock.getJdbcTemplate().query(
|
||||
"select name, age, birth_date, balance from people",
|
||||
new BeanPropertyRowMapper<ConcretePerson>(ConcretePerson.class, true));
|
||||
new BeanPropertyRowMapper<>(ConcretePerson.class, true));
|
||||
assertEquals(1, result.size());
|
||||
verifyConcretePerson(result.get(0));
|
||||
mock.verifyClosed();
|
||||
@@ -92,7 +92,7 @@ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests {
|
||||
Mock mock = new Mock();
|
||||
List<ExtendedPerson> result = mock.getJdbcTemplate().query(
|
||||
"select name, age, birth_date, balance from people",
|
||||
new BeanPropertyRowMapper<ExtendedPerson>(ExtendedPerson.class));
|
||||
new BeanPropertyRowMapper<>(ExtendedPerson.class));
|
||||
assertEquals(1, result.size());
|
||||
ExtendedPerson bean = result.get(0);
|
||||
verifyConcretePerson(bean);
|
||||
@@ -105,12 +105,12 @@ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests {
|
||||
thrown.expect(InvalidDataAccessApiUsageException.class);
|
||||
mock.getJdbcTemplate().query(
|
||||
"select name, age, birth_date, balance from people",
|
||||
new BeanPropertyRowMapper<ExtendedPerson>(ExtendedPerson.class, true));
|
||||
new BeanPropertyRowMapper<>(ExtendedPerson.class, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMappingNullValue() throws Exception {
|
||||
BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<Person>(Person.class);
|
||||
BeanPropertyRowMapper<Person> mapper = new BeanPropertyRowMapper<>(Person.class);
|
||||
Mock mock = new Mock(MockType.TWO);
|
||||
thrown.expect(TypeMismatchException.class);
|
||||
mock.getJdbcTemplate().query(
|
||||
@@ -122,7 +122,7 @@ public class BeanPropertyRowMapperTests extends AbstractRowMapperTests {
|
||||
Mock mock = new Mock(MockType.THREE);
|
||||
List<SpacePerson> result = mock.getJdbcTemplate().query(
|
||||
"select last_name as \"Last Name\", age, birth_date, balance from people",
|
||||
new BeanPropertyRowMapper<SpacePerson>(SpacePerson.class));
|
||||
new BeanPropertyRowMapper<>(SpacePerson.class));
|
||||
assertEquals(1, result.size());
|
||||
verifySpacePerson(result.get(0));
|
||||
mock.verifyClosed();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -224,7 +224,7 @@ public class JdbcTemplateTests {
|
||||
String[] results = { "rod", "gary", " portia" };
|
||||
|
||||
class StringHandler implements RowCallbackHandler {
|
||||
private List<String> list = new LinkedList<String>();
|
||||
private List<String> list = new LinkedList<>();
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
this.list.add(rs.getString(1));
|
||||
@@ -742,7 +742,7 @@ public class JdbcTemplateTests {
|
||||
public void testBatchUpdateWithListOfObjectArrays() throws Exception {
|
||||
|
||||
final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
|
||||
final List<Object[]> ids = new ArrayList<Object[]>();
|
||||
final List<Object[]> ids = new ArrayList<>();
|
||||
ids.add(new Object[] {100});
|
||||
ids.add(new Object[] {200});
|
||||
final int[] rowsAffected = new int[] { 1, 2 };
|
||||
@@ -768,7 +768,7 @@ public class JdbcTemplateTests {
|
||||
@Test
|
||||
public void testBatchUpdateWithListOfObjectArraysPlusTypeInfo() throws Exception {
|
||||
final String sql = "UPDATE NOSUCHTABLE SET DATE_DISPATCHED = SYSDATE WHERE ID = ?";
|
||||
final List<Object[]> ids = new ArrayList<Object[]>();
|
||||
final List<Object[]> ids = new ArrayList<>();
|
||||
ids.add(new Object[] {100});
|
||||
ids.add(new Object[] {200});
|
||||
final int[] sqlTypes = new int[] {Types.NUMERIC};
|
||||
@@ -1185,7 +1185,7 @@ public class JdbcTemplateTests {
|
||||
public CallableStatement createCallableStatement(Connection con) {
|
||||
return callableStatement;
|
||||
}
|
||||
}, new ArrayList<SqlParameter>());
|
||||
}, new ArrayList<>());
|
||||
|
||||
verify(this.resultSet, times(2)).close();
|
||||
verify(this.statement).close();
|
||||
@@ -1246,7 +1246,7 @@ public class JdbcTemplateTests {
|
||||
given(this.callableStatement.execute()).willReturn(true);
|
||||
given(this.callableStatement.getUpdateCount()).willReturn(-1);
|
||||
|
||||
List<SqlParameter> params = new ArrayList<SqlParameter>();
|
||||
List<SqlParameter> params = new ArrayList<>();
|
||||
params.add(new SqlReturnResultSet("", new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) {
|
||||
@@ -1286,7 +1286,7 @@ public class JdbcTemplateTests {
|
||||
assertTrue("now it should have been set to case insensitive",
|
||||
this.template.isResultsMapCaseInsensitive());
|
||||
|
||||
List<SqlParameter> params = new ArrayList<SqlParameter>();
|
||||
List<SqlParameter> params = new ArrayList<>();
|
||||
params.add(new SqlOutParameter("a", 12));
|
||||
|
||||
Map<String, Object> out = this.template.call(new CallableStatementCreator() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ public class NamedParameterJdbcTemplateTests {
|
||||
private PreparedStatement preparedStatement;
|
||||
private ResultSet resultSet;
|
||||
private DatabaseMetaData databaseMetaData;
|
||||
private Map<String, Object> params = new HashMap<String, Object>();
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
private NamedParameterJdbcTemplate namedParameterTemplate;
|
||||
|
||||
@Before
|
||||
@@ -242,7 +242,7 @@ public class NamedParameterJdbcTemplateTests {
|
||||
|
||||
params.put("id", new SqlParameterValue(Types.DECIMAL, 1));
|
||||
params.put("country", "UK");
|
||||
final List<Customer> customers = new LinkedList<Customer>();
|
||||
final List<Customer> customers = new LinkedList<>();
|
||||
namedParameterTemplate.query(SELECT_NAMED_PARAMETERS, params, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
@@ -269,7 +269,7 @@ public class NamedParameterJdbcTemplateTests {
|
||||
given(resultSet.getInt("id")).willReturn(1);
|
||||
given(resultSet.getString("forename")).willReturn("rod");
|
||||
|
||||
final List<Customer> customers = new LinkedList<Customer>();
|
||||
final List<Customer> customers = new LinkedList<>();
|
||||
namedParameterTemplate.query(SELECT_NO_PARAMETERS, new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -190,7 +190,7 @@ public class NamedParameterQueryTests {
|
||||
given(resultSet.next()).willReturn(true, false);
|
||||
given(resultSet.getInt(1)).willReturn(22);
|
||||
|
||||
Map<String, Object> parms = new HashMap<String, Object>();
|
||||
Map<String, Object> parms = new HashMap<>();
|
||||
parms.put("id", 3);
|
||||
Object o = template.queryForObject("SELECT AGE FROM CUSTMR WHERE ID = :id",
|
||||
parms, Integer.class);
|
||||
@@ -240,7 +240,7 @@ public class NamedParameterQueryTests {
|
||||
given(resultSet.getInt(1)).willReturn(22);
|
||||
|
||||
MapSqlParameterSource parms = new MapSqlParameterSource();
|
||||
List<Object[]> l1 = new ArrayList<Object[]>();
|
||||
List<Object[]> l1 = new ArrayList<>();
|
||||
l1.add(new Object[] {3, "Rod"});
|
||||
l1.add(new Object[] {4, "Juergen"});
|
||||
parms.addValue("multiExpressionList", l1);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -70,7 +70,7 @@ public class NamedParameterUtilsTests {
|
||||
|
||||
@Test
|
||||
public void convertParamMapToArray() {
|
||||
Map<String, String> paramMap = new HashMap<String, String>();
|
||||
Map<String, String> paramMap = new HashMap<>();
|
||||
paramMap.put("a", "a");
|
||||
paramMap.put("b", "b");
|
||||
paramMap.put("c", "c");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ public class CallMetaDataContextTests {
|
||||
given(databaseMetaData.getUserName()).willReturn(USER);
|
||||
given(databaseMetaData.storesLowerCaseIdentifiers()).willReturn(true);
|
||||
|
||||
List<SqlParameter> parameters = new ArrayList<SqlParameter>();
|
||||
List<SqlParameter> parameters = new ArrayList<>();
|
||||
parameters.add(new SqlParameter("id", Types.NUMERIC));
|
||||
parameters.add(new SqlInOutParameter("name", Types.NUMERIC));
|
||||
parameters.add(new SqlOutParameter("customer_no", Types.NUMERIC));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -79,7 +79,7 @@ public class SimpleJdbcInsertTests {
|
||||
// Shouldn't succeed in inserting into table which doesn't exist
|
||||
thrown.expect(InvalidDataAccessApiUsageException.class);
|
||||
try {
|
||||
insert.execute(new HashMap<String, Object>());
|
||||
insert.execute(new HashMap<>());
|
||||
}
|
||||
finally {
|
||||
verify(resultSet).close();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -98,7 +98,7 @@ public class TableMetaDataContextTests {
|
||||
map.registerSqlType("version", Types.NUMERIC);
|
||||
|
||||
context.setTableName(TABLE);
|
||||
context.processMetaData(dataSource, new ArrayList<String>(), new String[] {});
|
||||
context.processMetaData(dataSource, new ArrayList<>(), new String[] {});
|
||||
|
||||
List<Object> values = context.matchInParameterValuesWithInsertColumns(map);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class TableMetaDataContextTests {
|
||||
MapSqlParameterSource map = new MapSqlParameterSource();
|
||||
String[] keyCols = new String[] { "id" };
|
||||
context.setTableName(TABLE);
|
||||
context.processMetaData(dataSource, new ArrayList<String>(), keyCols);
|
||||
context.processMetaData(dataSource, new ArrayList<>(), keyCols);
|
||||
List<Object> values = context.matchInParameterValuesWithInsertColumns(map);
|
||||
String insertString = context.createInsertString(keyCols);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,7 +36,7 @@ public class JdbcDaoSupportTests {
|
||||
@Test
|
||||
public void testJdbcDaoSupportWithDataSource() throws Exception {
|
||||
DataSource ds = mock(DataSource.class);
|
||||
final List<String> test = new ArrayList<String>();
|
||||
final List<String> test = new ArrayList<>();
|
||||
JdbcDaoSupport dao = new JdbcDaoSupport() {
|
||||
@Override
|
||||
protected void initDao() {
|
||||
@@ -53,7 +53,7 @@ public class JdbcDaoSupportTests {
|
||||
@Test
|
||||
public void testJdbcDaoSupportWithJdbcTemplate() throws Exception {
|
||||
JdbcTemplate template = new JdbcTemplate();
|
||||
final List<String> test = new ArrayList<String>();
|
||||
final List<String> test = new ArrayList<>();
|
||||
JdbcDaoSupport dao = new JdbcDaoSupport() {
|
||||
@Override
|
||||
protected void initDao() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -672,7 +672,7 @@ given( userTransaction.getStatus()).willReturn(Status.STATUS_NO_TRANSACTION, St
|
||||
given(dataSource2.getConnection()).willReturn(connection2);
|
||||
|
||||
final IsolationLevelDataSourceRouter dsToUse = new IsolationLevelDataSourceRouter();
|
||||
Map<Object, Object> targetDataSources = new HashMap<Object, Object>();
|
||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||
if (dataSourceLookup) {
|
||||
targetDataSources.put("ISOLATION_REPEATABLE_READ", "ds2");
|
||||
dsToUse.setDefaultTargetDataSource("ds1");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ public class ScriptUtilsUnitTests {
|
||||
String cleanedStatement3 = "insert into orders(id, order_date, customer_id) values (1, '2008-01-02', 2)";
|
||||
char delim = ';';
|
||||
String script = rawStatement1 + delim + rawStatement2 + delim + rawStatement3 + delim;
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, delim, statements);
|
||||
assertEquals("wrong number of statements", 3, statements.size());
|
||||
assertEquals("statement 1 not split correctly", cleanedStatement1, statements.get(0));
|
||||
@@ -65,7 +65,7 @@ public class ScriptUtilsUnitTests {
|
||||
String statement3 = "insert into orders(id, order_date, customer_id) values (1, '2008-01-02', 2)";
|
||||
char delim = '\n';
|
||||
String script = statement1 + delim + statement2 + delim + statement3 + delim;
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, delim, statements);
|
||||
assertEquals("wrong number of statements", 3, statements.size());
|
||||
assertEquals("statement 1 not split correctly", statement1, statements.get(0));
|
||||
@@ -79,7 +79,7 @@ public class ScriptUtilsUnitTests {
|
||||
String statement2 = "do something else";
|
||||
char delim = '\n';
|
||||
String script = statement1 + delim + statement2 + delim;
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, DEFAULT_STATEMENT_SEPARATOR, statements);
|
||||
assertEquals("wrong number of statements", 1, statements.size());
|
||||
assertEquals("script should have been 'stripped' but not actually 'split'", script.replace('\n', ' '),
|
||||
@@ -95,7 +95,7 @@ public class ScriptUtilsUnitTests {
|
||||
String statement2 = "select '2' as \"Dilbert's\" from dual";
|
||||
char delim = ';';
|
||||
String script = statement1 + delim + statement2 + delim;
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, ';', statements);
|
||||
assertEquals("wrong number of statements", 2, statements.size());
|
||||
assertEquals("statement 1 not split correctly", statement1, statements.get(0));
|
||||
@@ -108,7 +108,7 @@ public class ScriptUtilsUnitTests {
|
||||
@Test
|
||||
public void readAndSplitScriptWithMultipleNewlinesAsSeparator() throws Exception {
|
||||
String script = readScript("db-test-data-multi-newline.sql");
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, "\n\n", statements);
|
||||
|
||||
String statement1 = "insert into T_TEST (NAME) values ('Keith')";
|
||||
@@ -122,7 +122,7 @@ public class ScriptUtilsUnitTests {
|
||||
@Test
|
||||
public void readAndSplitScriptContainingComments() throws Exception {
|
||||
String script = readScript("test-data-with-comments.sql");
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, ';', statements);
|
||||
|
||||
String statement1 = "insert into customer (id, name) values (1, 'Rod; Johnson'), (2, 'Adrian Collier')";
|
||||
@@ -144,7 +144,7 @@ public class ScriptUtilsUnitTests {
|
||||
@Test
|
||||
public void readAndSplitScriptContainingCommentsWithLeadingTabs() throws Exception {
|
||||
String script = readScript("test-data-with-comments-and-leading-tabs.sql");
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, ';', statements);
|
||||
|
||||
String statement1 = "insert into customer (id, name) values (1, 'Sam Brannen')";
|
||||
@@ -163,7 +163,7 @@ public class ScriptUtilsUnitTests {
|
||||
@Test
|
||||
public void readAndSplitScriptContainingMuliLineComments() throws Exception {
|
||||
String script = readScript("test-data-with-multi-line-comments.sql");
|
||||
List<String> statements = new ArrayList<String>();
|
||||
List<String> statements = new ArrayList<>();
|
||||
splitSqlScript(script, ';', statements);
|
||||
|
||||
String statement1 = "INSERT INTO users(first_name, last_name) VALUES('Juergen', 'Hoeller')";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -50,7 +50,7 @@ public final class MapDataSourceLookupTests {
|
||||
|
||||
@Test
|
||||
public void lookupSunnyDay() throws Exception {
|
||||
Map<String, DataSource> dataSources = new HashMap<String, DataSource>();
|
||||
Map<String, DataSource> dataSources = new HashMap<>();
|
||||
StubDataSource expectedDataSource = new StubDataSource();
|
||||
dataSources.put(DATA_SOURCE_NAME, expectedDataSource);
|
||||
MapDataSourceLookup lookup = new MapDataSourceLookup();
|
||||
@@ -62,7 +62,7 @@ public final class MapDataSourceLookupTests {
|
||||
|
||||
@Test
|
||||
public void setDataSourcesIsAnIdempotentOperation() throws Exception {
|
||||
Map<String, DataSource> dataSources = new HashMap<String, DataSource>();
|
||||
Map<String, DataSource> dataSources = new HashMap<>();
|
||||
StubDataSource expectedDataSource = new StubDataSource();
|
||||
dataSources.put(DATA_SOURCE_NAME, expectedDataSource);
|
||||
MapDataSourceLookup lookup = new MapDataSourceLookup();
|
||||
@@ -75,7 +75,7 @@ public final class MapDataSourceLookupTests {
|
||||
|
||||
@Test
|
||||
public void addingDataSourcePermitsOverride() throws Exception {
|
||||
Map<String, DataSource> dataSources = new HashMap<String, DataSource>();
|
||||
Map<String, DataSource> dataSources = new HashMap<>();
|
||||
StubDataSource overridenDataSource = new StubDataSource();
|
||||
StubDataSource expectedDataSource = new StubDataSource();
|
||||
dataSources.put(DATA_SOURCE_NAME, overridenDataSource);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -93,7 +93,7 @@ public class GenericSqlQueryTests {
|
||||
|
||||
List<?> queryResults;
|
||||
if (namedParameters) {
|
||||
Map<String, Object> params = new HashMap<String, Object>(2);
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("id", 1);
|
||||
params.put("country", "UK");
|
||||
queryResults = query.executeByNamedParam(params);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -57,7 +57,7 @@ public class GenericStoredProcedureTests {
|
||||
given(connection.prepareCall("{call " + "add_invoice" + "(?, ?, ?)}")).willReturn(callableStatement);
|
||||
|
||||
StoredProcedure adder = (StoredProcedure) bf.getBean("genericProcedure");
|
||||
Map<String, Object> in = new HashMap<String, Object>(2);
|
||||
Map<String, Object> in = new HashMap<>(2);
|
||||
in.put("amount", 1106);
|
||||
in.put("custid", 3);
|
||||
Map<String, Object> out = adder.execute(in);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -109,7 +109,7 @@ public class RdbmsOperationTests {
|
||||
@Test
|
||||
public void unspecifiedMapParameters() {
|
||||
operation.setSql("select * from mytable");
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("col1", "value");
|
||||
exception.expect(InvalidDataAccessApiUsageException.class);
|
||||
operation.validateNamedParameters(params);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -498,7 +498,7 @@ public class SqlQueryTests {
|
||||
}
|
||||
|
||||
public Customer findCustomer(int id) {
|
||||
Map<String, Integer> params = new HashMap<String, Integer>();
|
||||
Map<String, Integer> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
return executeByNamedParam(params).get(0);
|
||||
}
|
||||
@@ -556,7 +556,7 @@ public class SqlQueryTests {
|
||||
}
|
||||
|
||||
public Customer findCustomer(int id, String country) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id", id);
|
||||
params.put("country", country);
|
||||
return executeByNamedParam(params).get(0);
|
||||
@@ -602,14 +602,14 @@ public class SqlQueryTests {
|
||||
}
|
||||
|
||||
public List<Customer> findCustomers(List<Integer> ids) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("ids", ids);
|
||||
return executeByNamedParam(params);
|
||||
}
|
||||
}
|
||||
|
||||
CustomerQuery query = new CustomerQuery(dataSource);
|
||||
List<Integer> ids = new ArrayList<Integer>();
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
ids.add(1);
|
||||
ids.add(2);
|
||||
List<Customer> cust = query.findCustomers(ids);
|
||||
@@ -654,7 +654,7 @@ public class SqlQueryTests {
|
||||
}
|
||||
|
||||
public List<Customer> findCustomers(Integer id) {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("id1", id);
|
||||
return executeByNamedParam(params);
|
||||
}
|
||||
@@ -701,7 +701,7 @@ public class SqlQueryTests {
|
||||
}
|
||||
|
||||
public List<Customer> findCustomers(Integer id1) {
|
||||
Map<String, Integer> params = new HashMap<String, Integer>();
|
||||
Map<String, Integer> params = new HashMap<>();
|
||||
params.put("id1", id1);
|
||||
return executeByNamedParam(params);
|
||||
}
|
||||
@@ -737,7 +737,7 @@ public class SqlQueryTests {
|
||||
}
|
||||
|
||||
CustomerUpdateQuery query = new CustomerUpdateQuery(dataSource);
|
||||
Map<Integer, String> values = new HashMap<Integer, String>(2);
|
||||
Map<Integer, String> values = new HashMap<>(2);
|
||||
values.put(1, "Rod");
|
||||
values.put(2, "Thomas");
|
||||
query.execute(2, values);
|
||||
|
||||
@@ -166,7 +166,7 @@ public class SqlUpdateTests {
|
||||
}
|
||||
|
||||
public int run(int performanceId, int type) {
|
||||
Map<String, Integer> params = new HashMap<String, Integer>();
|
||||
Map<String, Integer> params = new HashMap<>();
|
||||
params.put("perfId", performanceId);
|
||||
params.put("priceId", type);
|
||||
return updateByNamedParam(params);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -447,7 +447,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public int execute(int intIn) {
|
||||
Map<String, Integer> in = new HashMap<String, Integer>();
|
||||
Map<String, Integer> in = new HashMap<>();
|
||||
in.put("intIn", intIn);
|
||||
Map<String, Object> out = execute(in);
|
||||
return ((Number) out.get("intOut")).intValue();
|
||||
@@ -468,7 +468,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public int execute(int amount, int custid) {
|
||||
Map<String, Integer> in = new HashMap<String, Integer>();
|
||||
Map<String, Integer> in = new HashMap<>();
|
||||
in.put("amount", amount);
|
||||
in.put("custid", custid);
|
||||
Map<String, Object> out = execute(in);
|
||||
@@ -507,7 +507,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public void execute(String s) {
|
||||
Map<String, String> in = new HashMap<String, String>();
|
||||
Map<String, String> in = new HashMap<>();
|
||||
in.put("ptest", s);
|
||||
execute(in);
|
||||
}
|
||||
@@ -524,7 +524,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
execute(new HashMap<String, Object>());
|
||||
execute(new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
execute(new HashMap<String, Object>());
|
||||
execute(new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +566,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
execute(new HashMap<String, Object>());
|
||||
execute(new HashMap<>());
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
@@ -593,7 +593,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public Map<String, Object> execute() {
|
||||
return execute(new HashMap<String, Object>());
|
||||
return execute(new HashMap<>());
|
||||
}
|
||||
|
||||
private static class RowMapperImpl implements RowMapper<String> {
|
||||
@@ -628,7 +628,7 @@ public class StoredProcedureTests {
|
||||
|
||||
@Override
|
||||
public Map<String, ?> createMap(Connection con) throws SQLException {
|
||||
Map<String, Object> inParms = new HashMap<String, Object>();
|
||||
Map<String, Object> inParms = new HashMap<>();
|
||||
String testValue = con.toString();
|
||||
inParms.put("in", testValue);
|
||||
return inParms;
|
||||
@@ -649,7 +649,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public Map<String, Object> executeTest(final int[] inValue) {
|
||||
Map<String, AbstractSqlTypeValue> in = new HashMap<String, AbstractSqlTypeValue>();
|
||||
Map<String, AbstractSqlTypeValue> in = new HashMap<>();
|
||||
in.put("in", new AbstractSqlTypeValue() {
|
||||
@Override
|
||||
public Object createTypeValue(Connection con, int type, String typeName) {
|
||||
@@ -675,7 +675,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public Map<String, Object> executeTest() {
|
||||
return execute(new HashMap<String, Object>());
|
||||
return execute(new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ public class StoredProcedureTests {
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
execute(new HashMap<String, Object>());
|
||||
execute(new HashMap<>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user