Skip to content

Commit f8499d0

Browse files
committed
Add serializable to hashMap usage in tests
1 parent 04b2658 commit f8499d0

13 files changed

+60
-0
lines changed

src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ void createCacheKeyWithAdditionalParameter() {
487487
Object parameterObject = 1;
488488

489489
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
490+
private static final long serialVersionUID = 1L;
491+
490492
{
491493
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
492494
}
@@ -519,6 +521,8 @@ void createCacheKeyWithNull() {
519521
Object parameterObject = null;
520522

521523
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
524+
private static final long serialVersionUID = 1L;
525+
522526
{
523527
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
524528
}
@@ -547,6 +551,8 @@ void createCacheKeyWithTypeHandler() {
547551
Object parameterObject = 1;
548552

549553
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
554+
private static final long serialVersionUID = 1L;
555+
550556
{
551557
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
552558
}
@@ -575,6 +581,8 @@ void createCacheKeyWithMetaObject() {
575581
Author parameterObject = new Author(-1, "cbegin", "******", "[email protected]", "N/A", Section.NEWS);
576582

577583
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
584+
private static final long serialVersionUID = 1L;
585+
578586
{
579587
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
580588
add(new ParameterMapping.Builder(config, "username", registry.getTypeHandler(String.class)).build());

src/test/java/org/apache/ibatis/reflection/wrapper/BeanWrapperUnitTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ void shouldGetWhichContainsDelim() {
7676
void shouldGetWhichContainsIndex() {
7777
richType.setRichList(Arrays.asList(1L, "abc"));
7878
richType.setRichMap(new HashMap<String, Object>() {
79+
private static final long serialVersionUID = 1L;
80+
7981
{
8082
put("key1", "value1");
8183
put("key2", "value2");

src/test/java/org/apache/ibatis/reflection/wrapper/CollectionWrapperUnitTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ void shouldAddElement() {
133133
@Override
134134
void shouldAddAll() {
135135
List<Object> list = new ArrayList<>() {
136+
private static final long serialVersionUID = 1L;
137+
136138
{
137139
add("1");
138140
add("2");

src/test/java/org/apache/ibatis/reflection/wrapper/MapWrapperUnitTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ void shouldSetWhichContainsDelim() {
105105
wrapper.set(new PropertyTokenizer("author.id"), 1);
106106

107107
verify(map).put("author", new HashMap<>() {
108+
private static final long serialVersionUID = 1L;
109+
108110
{
109111
put("id", 1);
110112
}
@@ -131,6 +133,8 @@ void shouldFindProperty() {
131133
@Override
132134
void shouldGetGetterNames() {
133135
Set<String> sets = new HashSet<>() {
136+
private static final long serialVersionUID = 1L;
137+
134138
{
135139
add("key1");
136140
add("key2");
@@ -148,6 +152,8 @@ void shouldGetGetterNames() {
148152
@Override
149153
void shouldGetSetterNames() {
150154
Set<String> sets = new HashSet<>() {
155+
private static final long serialVersionUID = 1L;
156+
151157
{
152158
add("key1");
153159
add("key2");

src/test/java/org/apache/ibatis/scripting/defaults/DefaultParameterHandlerTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ void parameterObjectGetPropertyValueWithAdditionalParameter() throws SQLExceptio
120120
Object parameterObject = 1;
121121

122122
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
123+
private static final long serialVersionUID = 1L;
124+
123125
{
124126
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
125127
}
@@ -150,6 +152,8 @@ void parameterObjectGetPropertyValueWithNull() throws SQLException {
150152
Object parameterObject = null;
151153

152154
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
155+
private static final long serialVersionUID = 1L;
156+
153157
{
154158
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
155159
}
@@ -176,6 +180,8 @@ void parameterObjectGetPropertyValueWithTypeHandler() throws SQLException {
176180
Object parameterObject = 1;
177181

178182
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
183+
private static final long serialVersionUID = 1L;
184+
179185
{
180186
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
181187
}
@@ -202,6 +208,8 @@ void parameterObjectGetPropertyValueWithMetaObject() throws SQLException {
202208
Author parameterObject = new Author(-1, "cbegin", "******", "[email protected]", "N/A", Section.NEWS);
203209

204210
BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
211+
private static final long serialVersionUID = 1L;
212+
205213
{
206214
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
207215
add(new ParameterMapping.Builder(config, "username", registry.getTypeHandler(String.class)).build());
@@ -250,6 +258,8 @@ void parameterObjectGetPropertyValueWithMetaObjectAndCreateOnce() {
250258
new StaticSqlSource(mockConfig, "some select statement"), SqlCommandType.SELECT).build();
251259

252260
BoundSql boundSql = new BoundSql(mockConfig, "some select statement", new ArrayList<ParameterMapping>() {
261+
private static final long serialVersionUID = 1L;
262+
253263
{
254264
add(new ParameterMapping.Builder(mockConfig, "id", registry.getTypeHandler(int.class))
255265
.jdbcType(JdbcType.INTEGER).build());

src/test/java/org/apache/ibatis/scripting/xmltags/ChooseSqlNodeTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ void setup() {
7272
@Override
7373
public void shouldApply() throws Exception {
7474
when(context.getBindings()).thenReturn(new HashMap<>() {
75+
private static final long serialVersionUID = 1L;
76+
7577
{
7678
put("title", "abc");
7779
put("author", new Author(1, "mybatis", "***", null, null, null));
@@ -87,6 +89,8 @@ public void shouldApply() throws Exception {
8789
@Test
8890
void shouldAppendSecond() throws Exception {
8991
when(context.getBindings()).thenReturn(new HashMap<>() {
92+
private static final long serialVersionUID = 1L;
93+
9094
{
9195
put("author", new Author(1, "mybatis", "***", null, null, null));
9296
}

src/test/java/org/apache/ibatis/scripting/xmltags/ForEachSqlNodeTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public void shouldApply() throws Exception {
6262
doNothing().when(context).bind(bindKeyCaptor.capture(), bindValueCaptor.capture());
6363

6464
when(context.getBindings()).thenReturn(new HashMap<>() {
65+
private static final long serialVersionUID = 1L;
66+
6567
{
6668
put("list", Arrays.asList("a", "b", "c"));
6769
}

src/test/java/org/apache/ibatis/scripting/xmltags/IfSqlNodeTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ void setup() {
5454
@Override
5555
public void shouldApply() throws Exception {
5656
when(context.getBindings()).thenReturn(new HashMap<>() {
57+
private static final long serialVersionUID = 1L;
58+
5759
{
5860
put("title", "ENGLISH");
5961
}
@@ -68,6 +70,8 @@ public void shouldApply() throws Exception {
6870
@Test
6971
void shouldAppendNone() {
7072
when(context.getBindings()).thenReturn(new HashMap<>() {
73+
private static final long serialVersionUID = 1L;
74+
7175
{
7276
put("title", null);
7377
}

src/test/java/org/apache/ibatis/scripting/xmltags/SetSqlNodeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ void setup() {
6363
@Override
6464
public void shouldApply() throws Exception {
6565
when(context.getBindings()).thenReturn(new HashMap<>() {
66+
private static final long serialVersionUID = 1L;
67+
6668
{
6769
put("username", "Jack");
6870
put("password", "***");
@@ -78,6 +80,8 @@ public void shouldApply() throws Exception {
7880
@Test
7981
void shouldAppendOnlyUsername() throws Exception {
8082
when(context.getBindings()).thenReturn(new HashMap<>() {
83+
private static final long serialVersionUID = 1L;
84+
8185
{
8286
put("username", "Jack");
8387
}
@@ -92,6 +96,8 @@ void shouldAppendOnlyUsername() throws Exception {
9296
@Test
9397
void shouldAppendOnlyPassword() throws Exception {
9498
when(context.getBindings()).thenReturn(new HashMap<>() {
99+
private static final long serialVersionUID = 1L;
100+
95101
{
96102
put("password", "***");
97103
}

src/test/java/org/apache/ibatis/scripting/xmltags/TextSqlNodeTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ void shouldApplyDynamic() {
5252
// given
5353
TextSqlNode sqlNode = new TextSqlNode(DYNAMIC_TEXT);
5454
when(context.getBindings()).thenReturn(new HashMap<>() {
55+
private static final long serialVersionUID = 1L;
56+
5557
{
5658
put("id", 1);
5759
}

src/test/java/org/apache/ibatis/scripting/xmltags/TrimSqlNodeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ void setup() {
6565
@Override
6666
public void shouldApply() throws Exception {
6767
when(context.getBindings()).thenReturn(new HashMap<>() {
68+
private static final long serialVersionUID = 1L;
69+
6870
{
6971
put("id", 1);
7072
put("name", "mybatis");
@@ -80,6 +82,8 @@ public void shouldApply() throws Exception {
8082
@Test
8183
void shouldAppendOnlyId() throws Exception {
8284
when(context.getBindings()).thenReturn(new HashMap<>() {
85+
private static final long serialVersionUID = 1L;
86+
8387
{
8488
put("id", 1);
8589
}
@@ -94,6 +98,8 @@ void shouldAppendOnlyId() throws Exception {
9498
@Test
9599
void shouldAppendOnlyName() throws Exception {
96100
when(context.getBindings()).thenReturn(new HashMap<>() {
101+
private static final long serialVersionUID = 1L;
102+
97103
{
98104
put("name", "mybatis");
99105
}

src/test/java/org/apache/ibatis/scripting/xmltags/VarDeclSqlNodeTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ void setup() {
4848
@Override
4949
public void shouldApply() throws Exception {
5050
when(context.getBindings()).thenReturn(new HashMap<>() {
51+
private static final long serialVersionUID = 1L;
52+
5153
{
5254
put("_parameter", new Bean("abc"));
5355
}

src/test/java/org/apache/ibatis/scripting/xmltags/WhereSqlNodeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ void setup() {
6363
@Override
6464
public void shouldApply() throws Exception {
6565
when(context.getBindings()).thenReturn(new HashMap<>() {
66+
private static final long serialVersionUID = 1L;
67+
6668
{
6769
put("id", 1);
6870
put("name", "mybatis");
@@ -78,6 +80,8 @@ public void shouldApply() throws Exception {
7880
@Test
7981
void shouldAppendOnlyId() throws Exception {
8082
when(context.getBindings()).thenReturn(new HashMap<>() {
83+
private static final long serialVersionUID = 1L;
84+
8185
{
8286
put("id", 1);
8387
}
@@ -92,6 +96,8 @@ void shouldAppendOnlyId() throws Exception {
9296
@Test
9397
void shouldAppendOnlyName() throws Exception {
9498
when(context.getBindings()).thenReturn(new HashMap<>() {
99+
private static final long serialVersionUID = 1L;
100+
95101
{
96102
put("name", "mybatis");
97103
}

0 commit comments

Comments
 (0)