Skip to content

Commit 8529238

Browse files
authored
Merge pull request #2822 from hazendaz/copyright
[tests] Various cleanups via Eclipse with extra hand holding
2 parents 7c5df27 + 9214c1d commit 8529238

File tree

89 files changed

+260
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+260
-258
lines changed

src/test/java/org/apache/ibatis/binding/BindingTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void shouldFindPostsInList() {
107107
try (SqlSession session = sqlSessionFactory.openSession()) {
108108
BoundAuthorMapper mapper = session.getMapper(BoundAuthorMapper.class);
109109
List<Post> posts = mapper.findPostsInList(new ArrayList<Integer>() {
110+
private static final long serialVersionUID = 1L;
110111
{
111112
add(1);
112113
add(3);
@@ -122,7 +123,7 @@ void shouldFindPostsInList() {
122123
void shouldFindPostsInArray() {
123124
try (SqlSession session = sqlSessionFactory.openSession()) {
124125
BoundAuthorMapper mapper = session.getMapper(BoundAuthorMapper.class);
125-
Integer[] params = new Integer[] { 1, 3, 5 };
126+
Integer[] params = { 1, 3, 5 };
126127
List<Post> posts = mapper.findPostsInArray(params);
127128
assertEquals(3, posts.size());
128129
session.rollback();
@@ -430,6 +431,7 @@ void shouldSelectOneBlogAsMap() {
430431
try (SqlSession session = sqlSessionFactory.openSession()) {
431432
BoundBlogMapper mapper = session.getMapper(BoundBlogMapper.class);
432433
Map<String, Object> blog = mapper.selectBlogAsMap(new HashMap<String, Object>() {
434+
private static final long serialVersionUID = 1L;
433435
{
434436
put("id", 1);
435437
}
@@ -588,8 +590,7 @@ void shouldCacheMapperMethod() throws Exception {
588590
try (SqlSession session = sqlSessionFactory.openSession()) {
589591

590592
// Create another mapper instance with a method cache we can test against:
591-
final MapperProxyFactory<BoundBlogMapper> mapperProxyFactory = new MapperProxyFactory<BoundBlogMapper>(
592-
BoundBlogMapper.class);
593+
final MapperProxyFactory<BoundBlogMapper> mapperProxyFactory = new MapperProxyFactory<>(BoundBlogMapper.class);
593594
assertEquals(BoundBlogMapper.class, mapperProxyFactory.getMapperInterface());
594595
final BoundBlogMapper mapper = mapperProxyFactory.newInstance(session);
595596
assertNotSame(mapper, mapperProxyFactory.newInstance(session));

src/test/java/org/apache/ibatis/builder/ExampleObjectFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
2222

2323
public class ExampleObjectFactory extends DefaultObjectFactory {
24+
private static final long serialVersionUID = 1L;
2425
private Properties properties;
2526

2627
@Override

src/test/java/org/apache/ibatis/builder/xml/dynamic/DynamicSqlSourceTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ void shouldConditionallyDefault() throws Exception {
8787
final String expected = "SELECT * FROM BLOG WHERE CATEGORY = 'DEFAULT'";
8888
DynamicSqlSource source = createDynamicSqlSource(new TextSqlNode("SELECT * FROM BLOG"),
8989
new ChooseSqlNode(new ArrayList<SqlNode>() {
90+
private static final long serialVersionUID = 1L;
9091
{
9192
add(new IfSqlNode(mixedContents(new TextSqlNode("WHERE CATEGORY = ?")), "false"));
9293
add(new IfSqlNode(mixedContents(new TextSqlNode("WHERE CATEGORY = 'NONE'")), "false"));
@@ -101,6 +102,7 @@ void shouldConditionallyChooseFirst() throws Exception {
101102
final String expected = "SELECT * FROM BLOG WHERE CATEGORY = ?";
102103
DynamicSqlSource source = createDynamicSqlSource(new TextSqlNode("SELECT * FROM BLOG"),
103104
new ChooseSqlNode(new ArrayList<SqlNode>() {
105+
private static final long serialVersionUID = 1L;
104106
{
105107
add(new IfSqlNode(mixedContents(new TextSqlNode("WHERE CATEGORY = ?")), "true"));
106108
add(new IfSqlNode(mixedContents(new TextSqlNode("WHERE CATEGORY = 'NONE'")), "false"));
@@ -115,6 +117,7 @@ void shouldConditionallyChooseSecond() throws Exception {
115117
final String expected = "SELECT * FROM BLOG WHERE CATEGORY = 'NONE'";
116118
DynamicSqlSource source = createDynamicSqlSource(new TextSqlNode("SELECT * FROM BLOG"),
117119
new ChooseSqlNode(new ArrayList<SqlNode>() {
120+
private static final long serialVersionUID = 1L;
118121
{
119122
add(new IfSqlNode(mixedContents(new TextSqlNode("WHERE CATEGORY = ?")), "false"));
120123
add(new IfSqlNode(mixedContents(new TextSqlNode("WHERE CATEGORY = 'NONE'")), "true"));
@@ -261,7 +264,8 @@ void shouldTrimNoSetClause() throws Exception {
261264

262265
@Test
263266
void shouldIterateOnceForEachItemInCollection() throws Exception {
264-
final HashMap<String, String[]> parameterObject = new HashMap<String, String[]>() {
267+
final HashMap<String, String[]> parameterObject = new HashMap<>() {
268+
private static final long serialVersionUID = 1L;
265269
{
266270
put("array", new String[] { "one", "two", "three" });
267271
}
@@ -280,7 +284,8 @@ void shouldIterateOnceForEachItemInCollection() throws Exception {
280284

281285
@Test
282286
void shouldHandleOgnlExpression() throws Exception {
283-
final HashMap<String, String> parameterObject = new HashMap<String, String>() {
287+
final HashMap<String, String> parameterObject = new HashMap<>() {
288+
private static final long serialVersionUID = 1L;
284289
{
285290
put("name", "Steve");
286291
}
@@ -294,7 +299,8 @@ void shouldHandleOgnlExpression() throws Exception {
294299

295300
@Test
296301
void shouldSkipForEachWhenCollectionIsEmpty() throws Exception {
297-
final HashMap<String, Integer[]> parameterObject = new HashMap<String, Integer[]>() {
302+
final HashMap<String, Integer[]> parameterObject = new HashMap<>() {
303+
private static final long serialVersionUID = 1L;
298304
{
299305
put("array", new Integer[] {});
300306
}

src/test/java/org/apache/ibatis/builder/xml/dynamic/ExpressionEvaluatorTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ class Bean {
8383

8484
@Test
8585
void shouldIterateOverIterable() {
86-
final HashMap<String, String[]> parameterObject = new HashMap<String, String[]>() {
86+
final HashMap<String, String[]> parameterObject = new HashMap<>() {
87+
private static final long serialVersionUID = 1L;
8788
{
8889
put("array", new String[] { "1", "2", "3" });
8990
}

src/test/java/org/apache/ibatis/cache/CacheKeyTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ void shouldDemonstrateEmptyAndNullKeysAreEqual() {
8181

8282
@Test
8383
void shouldTestCacheKeysWithBinaryArrays() {
84-
byte[] array1 = new byte[] { 1 };
85-
byte[] array2 = new byte[] { 1 };
84+
byte[] array1 = { 1 };
85+
byte[] array2 = { 1 };
8686
CacheKey key1 = new CacheKey(new Object[] { array1 });
8787
CacheKey key2 = new CacheKey(new Object[] { array2 });
8888
assertEquals(key1, key2);

src/test/java/org/apache/ibatis/cache/SerializedCacheTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void throwExceptionWhenTryingToCacheNonSerializableObject() {
5656
}
5757

5858
static class CachingObject implements Serializable {
59+
private static final long serialVersionUID = 1L;
5960
int x;
6061

6162
public CachingObject(int x) {

src/test/java/org/apache/ibatis/cache/SoftCacheTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void shouldDemonstrateObjectsBeingCollectedAsNeeded() {
3434
byte[] array = new byte[5001]; // waste a bunch of memory
3535
array[5000] = 1;
3636
cache.putObject(i, array);
37-
Object value = cache.getObject(i);
37+
cache.getObject(i);
3838
if (cache.getSize() < i + 1) {
3939
// System.out.println("Cache exceeded with " + (i + 1) + " entries.");
4040
break;

src/test/java/org/apache/ibatis/cache/SuperCacheTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void shouldDemonstrate5LevelSuperCacheHandlesLotsOfEntriesWithoutCrashing() {
4747
cache.putObject(i, i);
4848
((TransactionalCache) cache).commit();
4949
Object o = cache.getObject(i);
50-
assertTrue(o == null || i == ((Integer) o));
50+
assertTrue(o == null || i == (Integer) o);
5151
}
5252
assertTrue(cache.getSize() < N);
5353
}

src/test/java/org/apache/ibatis/cursor/defaults/DefaultCursorTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ void shouldCloseImmediatelyIfResultSetIsClosed() throws Exception {
9999
}
100100
}
101101

102-
@SuppressWarnings("serial")
103102
private MappedStatement getNestedAndOrderedMappedStatement() {
104103
final Configuration config = new Configuration();
105104
final TypeHandlerRegistry registry = config.getTypeHandlerRegistry();
106105

107106
ResultMap nestedResultMap = new ResultMap.Builder(config, "roleMap", HashMap.class, new ArrayList<ResultMapping>() {
107+
private static final long serialVersionUID = 1L;
108108
{
109109
add(new ResultMapping.Builder(config, "role", "role", registry.getTypeHandler(String.class)).build());
110110
}
@@ -113,8 +113,10 @@ private MappedStatement getNestedAndOrderedMappedStatement() {
113113

114114
return new MappedStatement.Builder(config, "selectPerson", new StaticSqlSource(config, "select person..."),
115115
SqlCommandType.SELECT).resultMaps(new ArrayList<ResultMap>() {
116+
private static final long serialVersionUID = 1L;
116117
{
117118
add(new ResultMap.Builder(config, "personMap", HashMap.class, new ArrayList<ResultMapping>() {
119+
private static final long serialVersionUID = 1L;
118120
{
119121
add(new ResultMapping.Builder(config, "id", "id", registry.getTypeHandler(Integer.class)).build());
120122
add(new ResultMapping.Builder(config, "roles").nestedResultMapId("roleMap").build());

src/test/java/org/apache/ibatis/datasource/jndi/JndiDataSourceFactoryTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void shouldRetrieveDataSourceFromJNDI() {
5151
createJndiDataSource();
5252
JndiDataSourceFactory factory = new JndiDataSourceFactory();
5353
factory.setProperties(new Properties() {
54+
private static final long serialVersionUID = 1L;
5455
{
5556
setProperty(JndiDataSourceFactory.ENV_PREFIX + Context.INITIAL_CONTEXT_FACTORY, TEST_INITIAL_CONTEXT_FACTORY);
5657
setProperty(JndiDataSourceFactory.INITIAL_CONTEXT, TEST_INITIAL_CONTEXT);

0 commit comments

Comments
 (0)