Skip to content

Commit b1bc2e0

Browse files
committed
[ci] Various small items cleaning up assignments
1 parent 55f7c39 commit b1bc2e0

File tree

17 files changed

+32
-85
lines changed

17 files changed

+32
-85
lines changed

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/datasource/unpooled/UnpooledDataSourceTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ class UnpooledDataSourceTest {
3131
@Test
3232
void shouldNotRegisterTheSameDriverMultipleTimes() throws Exception {
3333
// https://github.com/mybatis/old-google-code-issues/issues/430
34-
UnpooledDataSource dataSource = null;
35-
dataSource = new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:multipledrivers", "sa", "");
34+
UnpooledDataSource dataSource = new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:multipledrivers",
35+
"sa", "");
3636
dataSource.getConnection().close();
3737
int before = countRegisteredDrivers();
3838
dataSource = new UnpooledDataSource("org.hsqldb.jdbcDriver", "jdbc:hsqldb:mem:multipledrivers", "sa", "");
@@ -44,12 +44,10 @@ void shouldNotRegisterTheSameDriverMultipleTimes() throws Exception {
4444
@Test
4545
void shouldRegisterDynamicallyLoadedDriver() throws Exception {
4646
int before = countRegisteredDrivers();
47-
ClassLoader driverClassLoader = null;
48-
UnpooledDataSource dataSource = null;
49-
driverClassLoader = new URLClassLoader(
47+
ClassLoader driverClassLoader = new URLClassLoader(
5048
new URL[] { new URL("jar:file:/PATH_TO/mysql-connector-java-5.1.25.jar!/") });
51-
dataSource = new UnpooledDataSource(driverClassLoader, "com.mysql.jdbc.Driver", "jdbc:mysql://127.0.0.1/test",
52-
"root", "");
49+
UnpooledDataSource dataSource = new UnpooledDataSource(driverClassLoader, "com.mysql.jdbc.Driver",
50+
"jdbc:mysql://127.0.0.1/test", "root", "");
5351
dataSource.getConnection().close();
5452
assertEquals(before + 1, countRegisteredDrivers());
5553
driverClassLoader = new URLClassLoader(

src/test/java/org/apache/ibatis/domain/blog/Author.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,9 @@ public boolean equals(Object o) {
103103

104104
Author author = (Author) o;
105105

106-
if (id != author.id) {
107-
return false;
108-
}
109-
if (bio != null ? !bio.equals(author.bio) : author.bio != null) {
110-
return false;
111-
}
112-
if (email != null ? !email.equals(author.email) : author.email != null) {
113-
return false;
114-
}
115-
if (password != null ? !password.equals(author.password) : author.password != null) {
106+
if ((id != author.id) || (bio != null ? !bio.equals(author.bio) : author.bio != null)
107+
|| (email != null ? !email.equals(author.email) : author.email != null)
108+
|| (password != null ? !password.equals(author.password) : author.password != null)) {
116109
return false;
117110
}
118111
if (username != null ? !username.equals(author.username) : author.username != null) {

src/test/java/org/apache/ibatis/domain/blog/ComplexImmutableAuthor.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,9 @@ public boolean equals(Object o) {
5252

5353
final ComplexImmutableAuthor that = (ComplexImmutableAuthor) o;
5454

55-
if (bio != null ? !bio.equals(that.bio) : that.bio != null) {
56-
return false;
57-
}
58-
if (favouriteSection != that.favouriteSection) {
59-
return false;
60-
}
61-
if (theComplexImmutableAuthorId != null ? !theComplexImmutableAuthorId.equals(that.theComplexImmutableAuthorId)
62-
: that.theComplexImmutableAuthorId != null) {
55+
if ((bio != null ? !bio.equals(that.bio) : that.bio != null) || (favouriteSection != that.favouriteSection)
56+
|| (theComplexImmutableAuthorId != null ? !theComplexImmutableAuthorId.equals(that.theComplexImmutableAuthorId)
57+
: that.theComplexImmutableAuthorId != null)) {
6358
return false;
6459
}
6560

src/test/java/org/apache/ibatis/domain/blog/ComplexImmutableAuthorId.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,9 @@ public boolean equals(Object o) {
5555

5656
final ComplexImmutableAuthorId that = (ComplexImmutableAuthorId) o;
5757

58-
if (id != that.id) {
59-
return false;
60-
}
61-
if (email != null ? !email.equals(that.email) : that.email != null) {
62-
return false;
63-
}
64-
if (password != null ? !password.equals(that.password) : that.password != null) {
65-
return false;
66-
}
67-
if (username != null ? !username.equals(that.username) : that.username != null) {
58+
if ((id != that.id) || (email != null ? !email.equals(that.email) : that.email != null)
59+
|| (password != null ? !password.equals(that.password) : that.password != null)
60+
|| (username != null ? !username.equals(that.username) : that.username != null)) {
6861
return false;
6962
}
7063

src/test/java/org/apache/ibatis/domain/blog/ImmutableAuthor.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,9 @@ public boolean equals(Object o) {
7070

7171
Author author = (Author) o;
7272

73-
if (id != author.id) {
74-
return false;
75-
}
76-
if (bio != null ? !bio.equals(author.bio) : author.bio != null) {
77-
return false;
78-
}
79-
if (email != null ? !email.equals(author.email) : author.email != null) {
80-
return false;
81-
}
82-
if (password != null ? !password.equals(author.password) : author.password != null) {
73+
if ((id != author.id) || (bio != null ? !bio.equals(author.bio) : author.bio != null)
74+
|| (email != null ? !email.equals(author.email) : author.email != null)
75+
|| (password != null ? !password.equals(author.password) : author.password != null)) {
8376
return false;
8477
}
8578
if (username != null ? !username.equals(author.username) : author.username != null) {

src/test/java/org/apache/ibatis/domain/blog/PostLite.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ public boolean equals(Object o) {
5454

5555
final PostLite that = (PostLite) o;
5656

57-
if (blogId != that.blogId) {
58-
return false;
59-
}
60-
if (theId != null ? !theId.equals(that.theId) : that.theId != null) {
57+
if ((blogId != that.blogId) || (theId != null ? !theId.equals(that.theId) : that.theId != null)) {
6158
return false;
6259
}
6360

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ void shouldInsertNewAuthorByProc() throws Exception {
167167
Author author = new Author(97, "someone", "******", "[email protected]", null, null);
168168
MappedStatement insertStatement = ExecutorTestHelper.prepareInsertAuthorProc(config);
169169
MappedStatement selectStatement = ExecutorTestHelper.prepareSelectOneAuthorMappedStatement(config);
170-
int rows = executor.update(insertStatement, author);
170+
executor.update(insertStatement, author);
171171
List<Author> authors = executor.query(selectStatement, 97, RowBounds.DEFAULT, Executor.NO_RESULT_HANDLER);
172172
executor.flushStatements();
173173
executor.rollback(true);

src/test/java/org/apache/ibatis/executor/loader/SerializableProxyTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.io.ObjectOutputStream;
2626
import java.io.ObjectStreamException;
2727
import java.io.Serializable;
28-
import java.lang.reflect.Method;
2928
import java.util.ArrayList;
3029

3130
import org.apache.ibatis.domain.blog.Author;
@@ -128,7 +127,7 @@ void shouldGenerateWriteReplace() throws Exception {
128127
}
129128
Object proxy = proxyFactory.createProxy(author, new ResultLoaderMap(), new Configuration(),
130129
new DefaultObjectFactory(), new ArrayList<>(), new ArrayList<>());
131-
Method m = proxy.getClass().getDeclaredMethod("writeReplace");
130+
proxy.getClass().getDeclaredMethod("writeReplace");
132131
}
133132

134133
@Test

0 commit comments

Comments
 (0)