Ignore unknown field (#9)

This commit is contained in:
vitaxa 2021-08-12 13:12:57 +03:00 committed by GitHub
parent abcd6f0e91
commit 33c3a92f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 114 additions and 52 deletions

4
Jenkinsfile vendored
View File

@ -8,6 +8,6 @@ build('db-common-lib', 'docker-host') {
javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLib.groovy") javaLibPipeline = load("build_utils/jenkins_lib/pipeJavaLib.groovy")
} }
def buildImageTag = "b04c5291d101132e53e578d96e1628d2e6dab0c0" def buildImageTag = "917afcdd0c0a07bf4155d597bbba72e962e1a34a"
javaLibPipeline(buildImageTag) javaLibPipeline(buildImageTag)
} }

@ -1 +1 @@
Subproject commit 5cb25f049c719a608276a99fc4fbe852187019ca Subproject commit a7655bc60c877a65cdfe3d9b668021d970d88a76

View File

@ -13,7 +13,7 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<artifactId>db-common-lib</artifactId> <artifactId>db-common-lib</artifactId>
<version>0.0.3</version> <version>0.0.4</version>
<name>db-common-lib</name> <name>db-common-lib</name>
<description>Abstract dao and row mappers</description> <description>Abstract dao and row mappers</description>
@ -61,7 +61,7 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId> <artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.3.0.RELEASE</version> <version>2.5.3</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -12,23 +12,32 @@ public interface GenericDao {
<T> T fetchOne(Query query, Class<T> type) throws DaoException; <T> T fetchOne(Query query, Class<T> type) throws DaoException;
<T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; <T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
throws DaoException;
<T> T fetchOne(Query query, RowMapper<T> rowMapper) throws DaoException; <T> T fetchOne(Query query, RowMapper<T> rowMapper) throws DaoException;
<T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException; <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException;
<T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; <T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
throws DaoException;
<T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; <T> T fetchOne(String namedSql,
SqlParameterSource parameterSource,
RowMapper<T> rowMapper,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
<T> List<T> fetch(Query query, RowMapper<T> rowMapper) throws DaoException; <T> List<T> fetch(Query query, RowMapper<T> rowMapper) throws DaoException;
<T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException; <T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException;
<T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; <T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
throws DaoException;
<T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; <T> List<T> fetch(String namedSql,
SqlParameterSource parameterSource,
RowMapper<T> rowMapper,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
void executeOne(Query query) throws DaoException; void executeOne(Query query) throws DaoException;
@ -42,7 +51,8 @@ public interface GenericDao {
int execute(Query query, int expectedRowsAffected) throws DaoException; int execute(Query query, int expectedRowsAffected) throws DaoException;
int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
throws DaoException;
int execute(String namedSql) throws DaoException; int execute(String namedSql) throws DaoException;
@ -50,31 +60,48 @@ public interface GenericDao {
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected) throws DaoException; int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected) throws DaoException;
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; int execute(String namedSql,
SqlParameterSource parameterSource,
int expectedRowsAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
int execute(Query query, KeyHolder keyHolder) throws DaoException; int execute(Query query, KeyHolder keyHolder) throws DaoException;
int execute(Query query, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException; int execute(Query query, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException;
int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException; int execute(Query query,
int expectedRowsAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate,
KeyHolder keyHolder) throws DaoException;
int execute(String namedSql, KeyHolder keyHolder) throws DaoException; int execute(String namedSql, KeyHolder keyHolder) throws DaoException;
int execute(String namedSql, SqlParameterSource parameterSource, KeyHolder keyHolder) throws DaoException; int execute(String namedSql, SqlParameterSource parameterSource, KeyHolder keyHolder) throws DaoException;
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException; int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, KeyHolder keyHolder)
throws DaoException;
int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException; int execute(String namedSql,
SqlParameterSource parameterSource,
int expectedRowsAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate,
KeyHolder keyHolder) throws DaoException;
long batchExecute(List<Query> queries) throws DaoException; long batchExecute(List<Query> queries) throws DaoException;
long batchExecute(List<Query> queries, int expectedRowsPerQueryAffected) throws DaoException; long batchExecute(List<Query> queries, int expectedRowsPerQueryAffected) throws DaoException;
long batchExecute(List<Query> queries, int expectedRowsPerQueryAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; long batchExecute(List<Query> queries,
int expectedRowsPerQueryAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
long batchExecute(String namedSql, List<SqlParameterSource> parameterSources) throws DaoException; long batchExecute(String namedSql, List<SqlParameterSource> parameterSources) throws DaoException;
long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsPerQueryAffected) throws DaoException; long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsPerQueryAffected)
throws DaoException;
long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsPerQueryAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException; long batchExecute(String namedSql,
List<SqlParameterSource> parameterSources,
int expectedRowsPerQueryAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException;
} }

View File

@ -45,7 +45,8 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public <T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public <T> T fetchOne(Query query, Class<T> type, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
throws DaoException {
return fetchOne(query, new SingleColumnRowMapper<>(type), namedParameterJdbcTemplate); return fetchOne(query, new SingleColumnRowMapper<>(type), namedParameterJdbcTemplate);
} }
@ -55,17 +56,21 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException { public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper)
throws DaoException {
return fetchOne(namedSql, parameterSource, rowMapper, getNamedParameterJdbcTemplate()); return fetchOne(namedSql, parameterSource, rowMapper, getNamedParameterJdbcTemplate());
} }
@Override @Override
public <T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public <T> T fetchOne(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
return fetchOne(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper, namedParameterJdbcTemplate); throws DaoException {
return fetchOne(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper,
namedParameterJdbcTemplate);
} }
@Override @Override
public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public <T> T fetchOne(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
try { try {
return namedParameterJdbcTemplate.queryForObject( return namedParameterJdbcTemplate.queryForObject(
namedSql, namedSql,
@ -85,17 +90,24 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public <T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper) throws DaoException { public <T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper)
throws DaoException {
return fetch(namedSql, parameterSource, rowMapper, getNamedParameterJdbcTemplate()); return fetch(namedSql, parameterSource, rowMapper, getNamedParameterJdbcTemplate());
} }
@Override @Override
public <T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public <T> List<T> fetch(Query query, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
return fetch(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper, namedParameterJdbcTemplate); throws DaoException {
return fetch(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), rowMapper,
namedParameterJdbcTemplate);
} }
@Override @Override
public <T> List<T> fetch(String namedSql, SqlParameterSource parameterSource, RowMapper<T> rowMapper, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public <T> List<T> fetch(
String namedSql,
SqlParameterSource parameterSource,
RowMapper<T> rowMapper,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
try { try {
return namedParameterJdbcTemplate.query( return namedParameterJdbcTemplate.query(
namedSql, namedSql,
@ -123,7 +135,8 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public void executeOne(String namedSql, SqlParameterSource parameterSource, KeyHolder keyHolder) throws DaoException { public void executeOne(String namedSql, SqlParameterSource parameterSource, KeyHolder keyHolder)
throws DaoException {
execute(namedSql, parameterSource, 1, keyHolder); execute(namedSql, parameterSource, 1, keyHolder);
} }
@ -138,8 +151,10 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate)
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected, namedParameterJdbcTemplate); throws DaoException {
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected,
namedParameterJdbcTemplate);
} }
@Override @Override
@ -153,19 +168,22 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected) throws DaoException { public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected)
throws DaoException {
return execute(namedSql, parameterSource, expectedRowsAffected, getNamedParameterJdbcTemplate()); return execute(namedSql, parameterSource, expectedRowsAffected, getNamedParameterJdbcTemplate());
} }
@Override @Override
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
try { try {
int rowsAffected = namedParameterJdbcTemplate.update( int rowsAffected = namedParameterJdbcTemplate.update(
namedSql, namedSql,
parameterSource); parameterSource);
if (expectedRowsAffected != -1 && rowsAffected != expectedRowsAffected) { if (expectedRowsAffected != -1 && rowsAffected != expectedRowsAffected) {
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected, rowsAffected); throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected,
rowsAffected);
} }
return rowsAffected; return rowsAffected;
} catch (NestedRuntimeException ex) { } catch (NestedRuntimeException ex) {
@ -180,12 +198,15 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
@Override @Override
public int execute(Query query, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException { public int execute(Query query, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException {
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected, getNamedParameterJdbcTemplate(), keyHolder); return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected,
getNamedParameterJdbcTemplate(), keyHolder);
} }
@Override @Override
public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException { public int execute(Query query, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate,
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected, namedParameterJdbcTemplate, keyHolder); KeyHolder keyHolder) throws DaoException {
return execute(query.getSQL(ParamType.NAMED), toSqlParameterSource(query.getParams()), expectedRowsAffected,
namedParameterJdbcTemplate, keyHolder);
} }
@Override @Override
@ -199,12 +220,14 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, KeyHolder keyHolder) throws DaoException { public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected,
KeyHolder keyHolder) throws DaoException {
return execute(namedSql, parameterSource, expectedRowsAffected, getNamedParameterJdbcTemplate(), keyHolder); return execute(namedSql, parameterSource, expectedRowsAffected, getNamedParameterJdbcTemplate(), keyHolder);
} }
@Override @Override
public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException { public int execute(String namedSql, SqlParameterSource parameterSource, int expectedRowsAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate, KeyHolder keyHolder) throws DaoException {
try { try {
int rowsAffected = namedParameterJdbcTemplate.update( int rowsAffected = namedParameterJdbcTemplate.update(
namedSql, namedSql,
@ -212,7 +235,8 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
keyHolder); keyHolder);
if (expectedRowsAffected != -1 && rowsAffected != expectedRowsAffected) { if (expectedRowsAffected != -1 && rowsAffected != expectedRowsAffected) {
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected, rowsAffected); throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, expectedRowsAffected,
rowsAffected);
} }
return rowsAffected; return rowsAffected;
} catch (NestedRuntimeException ex) { } catch (NestedRuntimeException ex) {
@ -231,14 +255,17 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public long batchExecute(List<Query> queries, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public long batchExecute(List<Query> queries,
int expectedRowsAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
AtomicLong affectedRowCounter = new AtomicLong(); AtomicLong affectedRowCounter = new AtomicLong();
queries.stream() queries.stream()
.collect( .collect(
Collectors.groupingBy( Collectors.groupingBy(
query -> query.getSQL(ParamType.NAMED), query -> query.getSQL(ParamType.NAMED),
LinkedHashMap::new, LinkedHashMap::new,
Collectors.mapping(query -> toSqlParameterSource(query.getParams()), Collectors.toList()) Collectors
.mapping(query -> toSqlParameterSource(query.getParams()), Collectors.toList())
) )
) )
.forEach( .forEach(
@ -261,17 +288,21 @@ public abstract class AbstractGenericDao extends NamedParameterJdbcDaoSupport im
} }
@Override @Override
public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected) throws DaoException { public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected)
throws DaoException {
return batchExecute(namedSql, parameterSources, expectedRowsAffected, getNamedParameterJdbcTemplate()); return batchExecute(namedSql, parameterSources, expectedRowsAffected, getNamedParameterJdbcTemplate());
} }
@Override @Override
public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected, NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException { public long batchExecute(String namedSql, List<SqlParameterSource> parameterSources, int expectedRowsAffected,
NamedParameterJdbcTemplate namedParameterJdbcTemplate) throws DaoException {
try { try {
int[] rowsPerBatchAffected = namedParameterJdbcTemplate.batchUpdate(namedSql, parameterSources.toArray(new SqlParameterSource[0])); int[] rowsPerBatchAffected = namedParameterJdbcTemplate
.batchUpdate(namedSql, parameterSources.toArray(new SqlParameterSource[0]));
if (rowsPerBatchAffected.length != parameterSources.size()) { if (rowsPerBatchAffected.length != parameterSources.size()) {
throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, parameterSources.size(), rowsPerBatchAffected.length); throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(namedSql, parameterSources.size(),
rowsPerBatchAffected.length);
} }
int count = 0; int count = 0;

View File

@ -32,9 +32,11 @@ public class RecordRowMapper<T> implements RowMapper<T> {
String columnName = rsMetaData.getColumnName(column); String columnName = rsMetaData.getColumnName(column);
Field field = record.field(columnName); Field field = record.field(columnName);
Object value = getFieldValue(field, resultSet); if (field != null) {
if (!resultSet.wasNull()) { Object value = getFieldValue(field, resultSet);
record.set(field, value); if (!resultSet.wasNull()) {
record.set(field, value);
}
} }
} }
return record.into(type); return record.into(type);

View File

@ -33,8 +33,9 @@ public class AbstractGenericDaoTest {
@Test @Test
public void batchExecuteTest() { public void batchExecuteTest() {
final NamedParameterJdbcTemplate namedParameterJdbcTemplateMock = mock(NamedParameterJdbcTemplate.class); final NamedParameterJdbcTemplate namedParameterJdbcTemplateMock = mock(NamedParameterJdbcTemplate.class);
int[] rowPerBatchAffected = { 1, 1 }; int[] rowPerBatchAffected = {1, 1};
when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class))).thenReturn(rowPerBatchAffected); when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class)))
.thenReturn(rowPerBatchAffected);
when(testDaoSpy.getNamedParameterJdbcTemplate()).thenReturn(namedParameterJdbcTemplateMock); when(testDaoSpy.getNamedParameterJdbcTemplate()).thenReturn(namedParameterJdbcTemplateMock);
final Map<String, Param<?>> firstParamMap = paramMapMock("testString", "testValue", String.class); final Map<String, Param<?>> firstParamMap = paramMapMock("testString", "testValue", String.class);
@ -59,8 +60,9 @@ public class AbstractGenericDaoTest {
@Test(expected = DaoException.class) @Test(expected = DaoException.class)
public void batchExceptionTest() { public void batchExceptionTest() {
final NamedParameterJdbcTemplate namedParameterJdbcTemplateMock = mock(NamedParameterJdbcTemplate.class); final NamedParameterJdbcTemplate namedParameterJdbcTemplateMock = mock(NamedParameterJdbcTemplate.class);
int[] rowPerBatchAffected = { 1 }; int[] rowPerBatchAffected = {1};
when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class))).thenReturn(rowPerBatchAffected); when(namedParameterJdbcTemplateMock.batchUpdate(anyString(), any(SqlParameterSource[].class)))
.thenReturn(rowPerBatchAffected);
when(testDaoSpy.getNamedParameterJdbcTemplate()).thenReturn(namedParameterJdbcTemplateMock); when(testDaoSpy.getNamedParameterJdbcTemplate()).thenReturn(namedParameterJdbcTemplateMock);
final Map<String, Param<?>> firstParamMap = paramMapMock("testString", "testValue", String.class); final Map<String, Param<?>> firstParamMap = paramMapMock("testString", "testValue", String.class);