Skip to content

Commit b45f64d

Browse files
committed
Source code cleanup by plugins
1 parent e9abfcd commit b45f64d

16 files changed

+211
-164
lines changed

src/site/ko/xdoc/java-api.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
4-
Copyright 2009-2023 the original author or authors.
4+
Copyright 2009-2024 the original author or authors.
55
66
Licensed under the Apache License, Version 2.0 (the "License");
77
you may not use this file except in compliance with the License.

src/test/java/org/apache/ibatis/reflection/property/PropertyTokenizerTest.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@
1515
*/
1616
package org.apache.ibatis.reflection.property;
1717

18-
import org.junit.jupiter.api.Test;
19-
20-
import static org.assertj.core.api.Assertions.*;
18+
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
2119
import static org.junit.jupiter.api.Assertions.*;
2220

21+
import org.junit.jupiter.api.Test;
22+
2323
/**
2424
* @author <a href="[email protected]">mawen12</a>
25+
*
2526
* @see PropertyTokenizer
2627
*/
2728
class PropertyTokenizerTest {
@@ -39,9 +40,8 @@ void shouldParsePropertySuccessfully() {
3940
assertFalse(tokenizer.hasNext());
4041
assertNull(tokenizer.getIndex());
4142

42-
assertThatExceptionOfType(UnsupportedOperationException.class)
43-
.isThrownBy(tokenizer::remove)
44-
.withMessage("Remove is not supported, as it has no meaning in the context of properties.");
43+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(tokenizer::remove)
44+
.withMessage("Remove is not supported, as it has no meaning in the context of properties.");
4545
}
4646

4747
@Test
@@ -56,9 +56,8 @@ void shouldParsePropertyWhichContainsDelimSuccessfully() {
5656

5757
assertNull(tokenizer.getIndex());
5858

59-
assertThatExceptionOfType(UnsupportedOperationException.class)
60-
.isThrownBy(tokenizer::remove)
61-
.withMessage("Remove is not supported, as it has no meaning in the context of properties.");
59+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(tokenizer::remove)
60+
.withMessage("Remove is not supported, as it has no meaning in the context of properties.");
6261
}
6362

6463
@Test
@@ -73,8 +72,7 @@ void shouldParsePropertyWhichContainsIndexSuccessfully() {
7372
assertFalse(tokenizer.hasNext());
7473
assertNull(tokenizer.getChildren());
7574

76-
assertThatExceptionOfType(UnsupportedOperationException.class)
77-
.isThrownBy(tokenizer::remove)
78-
.withMessage("Remove is not supported, as it has no meaning in the context of properties.");
75+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(tokenizer::remove)
76+
.withMessage("Remove is not supported, as it has no meaning in the context of properties.");
7977
}
8078
}

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,25 @@
1515
*/
1616
package org.apache.ibatis.reflection.wrapper;
1717

18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
20+
import static org.junit.jupiter.api.Assertions.*;
21+
1822
import java.util.ArrayList;
1923
import java.util.Arrays;
2024
import java.util.HashMap;
2125
import java.util.List;
2226
import java.util.Map;
2327

24-
import org.apache.ibatis.domain.blog.Author;
2528
import org.apache.ibatis.domain.misc.RichType;
2629
import org.apache.ibatis.reflection.SystemMetaObject;
2730
import org.apache.ibatis.reflection.property.PropertyTokenizer;
2831
import org.junit.jupiter.api.BeforeEach;
2932
import org.junit.jupiter.api.Test;
3033

31-
import static org.assertj.core.api.Assertions.*;
32-
import static org.junit.jupiter.api.Assertions.*;
33-
3434
/**
3535
* @author <a href="[email protected]">mawen12</a>
36+
*
3637
* @see BeanWrapper
3738
*/
3839
class BeanWrapperUnitTest extends ObjectWrapperBaseTest {
@@ -71,10 +72,12 @@ void shouldGetWhichContainsDelim() {
7172
@Test
7273
void shouldGetWhichContainsIndex() {
7374
richType.setRichList(Arrays.asList(1L, "abc"));
74-
richType.setRichMap(new HashMap<String, Object>(){{
75-
put("key1", "value1");
76-
put("key2", "value2");
77-
}});
75+
richType.setRichMap(new HashMap<String, Object>() {
76+
{
77+
put("key1", "value1");
78+
put("key2", "value2");
79+
}
80+
});
7881

7982
assertEquals("abc", wrapper.get(new PropertyTokenizer("richList[1]")));
8083
assertEquals("value2", wrapper.get(new PropertyTokenizer("richMap[key2]")));
@@ -199,15 +202,13 @@ void shouldInstantiatePropertyValue() {
199202
@Test
200203
@Override
201204
void shouldAddElement() {
202-
assertThatExceptionOfType(UnsupportedOperationException.class)
203-
.isThrownBy(() -> wrapper.add("1"));
205+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.add("1"));
204206
}
205207

206208
@Test
207209
@Override
208210
void shouldAddAll() {
209-
assertThatExceptionOfType(UnsupportedOperationException.class)
210-
.isThrownBy(() -> wrapper.addAll(new ArrayList<>()));
211+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.addAll(new ArrayList<>()));
211212
}
212213

213214
}

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

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
*/
1616
package org.apache.ibatis.reflection.wrapper;
1717

18+
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
19+
import static org.junit.jupiter.api.Assertions.assertTrue;
20+
import static org.mockito.Mockito.verify;
21+
1822
import java.util.ArrayList;
1923
import java.util.Collection;
2024
import java.util.List;
@@ -28,12 +32,9 @@
2832
import org.mockito.Mock;
2933
import org.mockito.junit.jupiter.MockitoExtension;
3034

31-
import static org.assertj.core.api.Assertions.*;
32-
import static org.junit.jupiter.api.Assertions.*;
33-
import static org.mockito.Mockito.*;
34-
3535
/**
3636
* @author <a href="[email protected]">mawen12</a>
37+
*
3738
* @see CollectionWrapper
3839
*/
3940
@ExtendWith(MockitoExtension.class)
@@ -56,64 +57,55 @@ void setup() {
5657
@Test
5758
@Override
5859
void shouldGet() {
59-
assertThatExceptionOfType(UnsupportedOperationException.class)
60-
.isThrownBy(() -> wrapper.get(tokenizer));
60+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.get(tokenizer));
6161
}
6262

6363
@Test
6464
@Override
6565
void shouldSet() {
66-
assertThatExceptionOfType(UnsupportedOperationException.class)
67-
.isThrownBy(() -> wrapper.set(tokenizer, null));
66+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.set(tokenizer, null));
6867
}
6968

7069
@Test
7170
@Override
7271
void shouldFindProperty() {
73-
assertThatExceptionOfType(UnsupportedOperationException.class)
74-
.isThrownBy(() -> wrapper.findProperty("abc", true));
72+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.findProperty("abc", true));
7573
}
7674

7775
@Test
7876
@Override
7977
void shouldGetGetterNames() {
80-
assertThatExceptionOfType(UnsupportedOperationException.class)
81-
.isThrownBy(() -> wrapper.getGetterNames());
78+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.getGetterNames());
8279
}
8380

8481
@Test
8582
@Override
8683
void shouldGetSetterNames() {
87-
assertThatExceptionOfType(UnsupportedOperationException.class)
88-
.isThrownBy(() -> wrapper.getSetterNames());
84+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.getSetterNames());
8985
}
9086

9187
@Test
9288
@Override
9389
void shouldGetGetterType() {
94-
assertThatExceptionOfType(UnsupportedOperationException.class)
95-
.isThrownBy(() -> wrapper.getGetterType("abc"));
90+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.getGetterType("abc"));
9691
}
9792

9893
@Test
9994
@Override
10095
void shouldGetSetterType() {
101-
assertThatExceptionOfType(UnsupportedOperationException.class)
102-
.isThrownBy(() -> wrapper.getSetterType("abc"));
96+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.getSetterType("abc"));
10397
}
10498

10599
@Test
106100
@Override
107101
void shouldHasGetter() {
108-
assertThatExceptionOfType(UnsupportedOperationException.class)
109-
.isThrownBy(() -> wrapper.hasGetter("abc"));
102+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.hasGetter("abc"));
110103
}
111104

112105
@Test
113106
@Override
114107
void shouldHasSetter() {
115-
assertThatExceptionOfType(UnsupportedOperationException.class)
116-
.isThrownBy(() -> wrapper.hasSetter("abc"));
108+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.hasSetter("abc"));
117109
}
118110

119111
@Test
@@ -126,7 +118,7 @@ void shouldIsCollection() {
126118
@Override
127119
void shouldInstantiatePropertyValue() {
128120
assertThatExceptionOfType(UnsupportedOperationException.class)
129-
.isThrownBy(() -> wrapper.instantiatePropertyValue("abc", tokenizer, null));
121+
.isThrownBy(() -> wrapper.instantiatePropertyValue("abc", tokenizer, null));
130122
}
131123

132124
@Test
@@ -140,11 +132,13 @@ void shouldAddElement() {
140132
@Test
141133
@Override
142134
void shouldAddAll() {
143-
List<Object> list = new ArrayList<>() {{
144-
add("1");
145-
add("2");
146-
add("3");
147-
}};
135+
List<Object> list = new ArrayList<>() {
136+
{
137+
add("1");
138+
add("2");
139+
add("3");
140+
}
141+
};
148142
wrapper.addAll(list);
149143

150144
verify(collection).addAll(list);

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

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
*/
1616
package org.apache.ibatis.reflection.wrapper;
1717

18+
import static org.assertj.core.api.Assertions.assertThat;
19+
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
20+
import static org.junit.jupiter.api.Assertions.*;
21+
import static org.mockito.Mockito.verify;
22+
import static org.mockito.Mockito.when;
23+
1824
import java.util.ArrayList;
1925
import java.util.HashMap;
2026
import java.util.HashSet;
@@ -30,12 +36,9 @@
3036
import org.junit.jupiter.api.Test;
3137
import org.mockito.Mock;
3238

33-
import static org.assertj.core.api.Assertions.*;
34-
import static org.junit.jupiter.api.Assertions.*;
35-
import static org.mockito.Mockito.*;
36-
3739
/**
3840
* @author <a href="[email protected]">mawen12</a>
41+
*
3942
* @see MapWrapper
4043
*/
4144
class MapWrapperUnitTest extends ObjectWrapperBaseTest {
@@ -99,9 +102,11 @@ void shouldSet() {
99102
void shouldSetWhichContainsDelim() {
100103
wrapper.set(new PropertyTokenizer("author.id"), 1);
101104

102-
verify(map).put("author", new HashMap<>() {{
103-
put("id", 1);
104-
}});
105+
verify(map).put("author", new HashMap<>() {
106+
{
107+
put("id", 1);
108+
}
109+
});
105110
}
106111

107112
@Test
@@ -123,10 +128,12 @@ void shouldFindProperty() {
123128
@Test
124129
@Override
125130
void shouldGetGetterNames() {
126-
Set<String> sets = new HashSet<>() {{
127-
add("key1");
128-
add("key2");
129-
}};
131+
Set<String> sets = new HashSet<>() {
132+
{
133+
add("key1");
134+
add("key2");
135+
}
136+
};
130137
when(map.keySet()).thenReturn(sets);
131138

132139
String[] getterNames = wrapper.getGetterNames();
@@ -138,10 +145,12 @@ void shouldGetGetterNames() {
138145
@Test
139146
@Override
140147
void shouldGetSetterNames() {
141-
Set<String> sets = new HashSet<>() {{
142-
add("key1");
143-
add("key2");
144-
}};
148+
Set<String> sets = new HashSet<>() {
149+
{
150+
add("key1");
151+
add("key2");
152+
}
153+
};
145154
when(map.keySet()).thenReturn(sets);
146155

147156
String[] setterNames = wrapper.getSetterNames();
@@ -219,22 +228,21 @@ void shouldIsCollection() {
219228
@Test
220229
@Override
221230
void shouldInstantiatePropertyValue() {
222-
MetaObject result = wrapper.instantiatePropertyValue("abc", new PropertyTokenizer("key"), SystemMetaObject.DEFAULT_OBJECT_FACTORY);
231+
MetaObject result = wrapper.instantiatePropertyValue("abc", new PropertyTokenizer("key"),
232+
SystemMetaObject.DEFAULT_OBJECT_FACTORY);
223233

224234
assertFalse(result.hasGetter("key"));
225235
}
226236

227237
@Test
228238
@Override
229239
void shouldAddElement() {
230-
assertThatExceptionOfType(UnsupportedOperationException.class)
231-
.isThrownBy(() -> wrapper.add("1"));
240+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.add("1"));
232241
}
233242

234243
@Test
235244
@Override
236245
void shouldAddAll() {
237-
assertThatExceptionOfType(UnsupportedOperationException.class)
238-
.isThrownBy(() -> wrapper.addAll(new ArrayList<>()));
246+
assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> wrapper.addAll(new ArrayList<>()));
239247
}
240248
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
/**
2222
* @author <a href="[email protected]">mawen12</a>
23+
*
2324
* @see ObjectWrapper
2425
*/
2526
@ExtendWith(MockitoExtension.class)

0 commit comments

Comments
 (0)