Skip to content

Commit 7788c29

Browse files
authored
Merge pull request mybatis#3344 from hazendaz/pom-cleanup
Further cleanup of tests
2 parents c2a647c + ca1f7bd commit 7788c29

27 files changed

+67
-45
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -121,8 +121,7 @@ public boolean equals(Object o) {
121121

122122
@Override
123123
public int hashCode() {
124-
int result;
125-
result = id;
124+
int result = id;
126125
result = 31 * result + (username != null ? username.hashCode() : 0);
127126
result = 31 * result + (password != null ? password.hashCode() : 0);
128127
result = 31 * result + (email != null ? email.hashCode() : 0);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ public boolean equals(Object o) {
5252

5353
final ComplexImmutableAuthor that = (ComplexImmutableAuthor) o;
5454

55-
if ((bio != null ? !bio.equals(that.bio) : that.bio != null) || (favouriteSection != that.favouriteSection)
55+
if ((bio != null ? !bio.equals(that.bio) : that.bio != null) || favouriteSection != that.favouriteSection
5656
|| (theComplexImmutableAuthorId != null ? !theComplexImmutableAuthorId.equals(that.theComplexImmutableAuthorId)
5757
: that.theComplexImmutableAuthorId != null)) {
5858
return false;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,7 +55,7 @@ public boolean equals(Object o) {
5555

5656
final ComplexImmutableAuthorId that = (ComplexImmutableAuthorId) o;
5757

58-
if ((id != that.id) || (email != null ? !email.equals(that.email) : that.email != null)
58+
if (id != that.id || (email != null ? !email.equals(that.email) : that.email != null)
5959
|| (password != null ? !password.equals(that.password) : that.password != null)
6060
|| (username != null ? !username.equals(that.username) : that.username != null)) {
6161
return false;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -88,8 +88,7 @@ public boolean equals(Object o) {
8888

8989
@Override
9090
public int hashCode() {
91-
int result;
92-
result = id;
91+
int result = id;
9392
result = 31 * result + (username != null ? username.hashCode() : 0);
9493
result = 31 * result + (password != null ? password.hashCode() : 0);
9594
result = 31 * result + (email != null ? email.hashCode() : 0);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ public boolean equals(Object o) {
5454

5555
final PostLite that = (PostLite) o;
5656

57-
if ((blogId != that.blogId) || (theId != null ? !theId.equals(that.theId) : that.theId != null)) {
57+
if (blogId != that.blogId || (theId != null ? !theId.equals(that.theId) : that.theId != null)) {
5858
return false;
5959
}
6060

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package org.apache.ibatis.executor.loader;
1717

18-
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
1918
import static org.junit.jupiter.api.Assertions.assertEquals;
2019
import static org.junit.jupiter.api.Assertions.assertFalse;
2120
import static org.junit.jupiter.api.Assertions.fail;

src/test/java/org/apache/ibatis/mapping/VendorDatabaseIdProviderTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
*/
1616
package org.apache.ibatis.mapping;
1717

18-
import static org.junit.jupiter.api.Assertions.*;
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertNull;
20+
import static org.junit.jupiter.api.Assertions.fail;
1921
import static org.mockito.Mockito.mock;
2022
import static org.mockito.Mockito.when;
2123

src/test/java/org/apache/ibatis/reflection/ArrayUtilTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,8 +27,7 @@ class ArrayUtilTest {
2727

2828
@Test
2929
void testHashCode() {
30-
Object arr;
31-
arr = new long[] { 1 };
30+
Object arr = new long[] { 1 };
3231
assertEquals(Arrays.hashCode((long[]) arr), ArrayUtil.hashCode(arr));
3332
arr = new int[] { 1 };
3433
assertEquals(Arrays.hashCode((int[]) arr), ArrayUtil.hashCode(arr));
@@ -84,8 +83,7 @@ void testequals() {
8483

8584
@Test
8685
void testToString() {
87-
Object arr;
88-
arr = new long[] { 1 };
86+
Object arr = new long[] { 1 };
8987
assertEquals(Arrays.toString((long[]) arr), ArrayUtil.toString(arr));
9088
arr = new int[] { 1 };
9189
assertEquals(Arrays.toString((int[]) arr), ArrayUtil.toString(arr));

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
package org.apache.ibatis.reflection.property;
1717

1818
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
19-
import static org.junit.jupiter.api.Assertions.*;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertFalse;
21+
import static org.junit.jupiter.api.Assertions.assertNull;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
2023

2124
import org.junit.jupiter.api.Test;
2225

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

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

18-
import static org.junit.jupiter.api.Assertions.*;
18+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertFalse;
21+
import static org.junit.jupiter.api.Assertions.assertNull;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
23+
import static org.junit.jupiter.api.Assertions.fail;
1924

2025
import java.util.ArrayList;
2126
import java.util.Arrays;

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
1919
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
20-
import static org.junit.jupiter.api.Assertions.*;
20+
import static org.junit.jupiter.api.Assertions.assertEquals;
21+
import static org.junit.jupiter.api.Assertions.assertFalse;
22+
import static org.junit.jupiter.api.Assertions.assertNull;
23+
import static org.junit.jupiter.api.Assertions.assertTrue;
2124

2225
import java.util.ArrayList;
2326
import java.util.Arrays;

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

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

18-
import static org.junit.jupiter.api.Assertions.*;
18+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.assertFalse;
21+
import static org.junit.jupiter.api.Assertions.assertNull;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
23+
import static org.junit.jupiter.api.Assertions.fail;
1924

2025
import java.util.Arrays;
2126
import java.util.HashMap;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
import static org.assertj.core.api.Assertions.assertThat;
1919
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
20-
import static org.junit.jupiter.api.Assertions.*;
20+
import static org.junit.jupiter.api.Assertions.assertEquals;
21+
import static org.junit.jupiter.api.Assertions.assertFalse;
22+
import static org.junit.jupiter.api.Assertions.assertTrue;
2123
import static org.mockito.Mockito.verify;
2224
import static org.mockito.Mockito.when;
2325

src/test/java/org/apache/ibatis/submitted/constructor_columnprefix/EntityKey.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,7 +38,7 @@ public boolean equals(Object obj) {
3838
if (this == obj) {
3939
return true;
4040
}
41-
if ((obj == null) || (getClass() != obj.getClass())) {
41+
if (obj == null || getClass() != obj.getClass()) {
4242
return false;
4343
}
4444
EntityKey other = (EntityKey) obj;

src/test/java/org/apache/ibatis/submitted/cursor_cache_oom/CursorOomTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ private static List<Cursor<?>> getCursors(SqlSession sqlSession) throws NoSuchFi
6969
DefaultSqlSession session = (DefaultSqlSession) sqlSession;
7070
Field cursorListField = DefaultSqlSession.class.getDeclaredField("cursorList");
7171
cursorListField.setAccessible(true);
72-
List<Cursor<?>> cursorList = (List<Cursor<?>>) cursorListField.get(session);
73-
return cursorList;
72+
return (List<Cursor<?>>) cursorListField.get(session);
7473
}
7574

7675
@Test

src/test/java/org/apache/ibatis/submitted/cursor_simple/CursorSimpleTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,7 @@ void shouldNullItemNotStopIteration() {
412412
// next() has not been called, index is still -1
413413
Assertions.assertEquals(-1, cursor.getCurrentIndex());
414414

415-
User user;
416-
user = iterator.next();
415+
User user = iterator.next();
417416
Assertions.assertNull(user);
418417
Assertions.assertEquals(0, cursor.getCurrentIndex());
419418

@@ -455,8 +454,7 @@ void shouldRowBoundsCountNullItem() {
455454
Assertions.assertTrue(cursor.isOpen());
456455
Assertions.assertFalse(cursor.isConsumed());
457456

458-
User user;
459-
user = iterator.next();
457+
User user = iterator.next();
460458
Assertions.assertEquals("Kate", user.getName());
461459
Assertions.assertEquals(1, cursor.getCurrentIndex());
462460

src/test/java/org/apache/ibatis/submitted/discriminator/Contract.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public class Contract {
2020
private Owner owner;
2121

2222
public Contract(Integer id, Owner owner) {
23-
super();
2423
this.id = id;
2524
this.owner = owner;
2625
}

src/test/java/org/apache/ibatis/submitted/discriminator/Owner.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,11 +21,9 @@ public class Owner {
2121
private Vehicle vehicle;
2222

2323
public Owner() {
24-
super();
2524
}
2625

2726
public Owner(Integer id, Vehicle vehicle) {
28-
super();
2927
this.id = id;
3028
this.vehicle = vehicle;
3129
}

src/test/java/org/apache/ibatis/submitted/enum_with_method/Mood.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public String getMessage() {
3131

3232
private int value;
3333

34-
private Mood(int value) {
34+
Mood(int value) {
3535
this.value = value;
3636
}
3737

src/test/java/org/apache/ibatis/submitted/primitive_result_type/PrimitiveResultTypeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void shouldReturnProperPrimitiveType() {
4242
}
4343
List<Long> lcodes = ProductDAO.selectProductCodesL();
4444
for (Object lcode : lcodes) {
45-
assertFalse((lcode instanceof Integer));
45+
assertFalse(lcode instanceof Integer);
4646
}
4747
List<BigDecimal> bcodes = ProductDAO.selectProductCodesB();
4848
for (Object bcode : bcodes) {

src/test/java/org/apache/ibatis/submitted/unmatched_prop_type/User.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2023 the original author or authors.
2+
* Copyright 2009-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@ public class User {
2323
private Birthday dob;
2424

2525
public User(String id, String name) {
26-
super();
2726
this.id = Integer.valueOf(id);
2827
this.name = name;
2928
}

src/test/java/org/apache/ibatis/transaction/jdbc/JdbcTransactionFactoryUnitTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
package org.apache.ibatis.transaction.jdbc;
1717

18-
import static org.junit.jupiter.api.Assertions.*;
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
20+
import static org.junit.jupiter.api.Assertions.assertNotNull;
21+
import static org.junit.jupiter.api.Assertions.assertTrue;
1922
import static org.mockito.Mockito.verify;
2023
import static org.mockito.Mockito.when;
2124

src/test/java/org/apache/ibatis/transaction/jdbc/JdbcTransactionWithConnectionTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
import static org.junit.jupiter.api.Assertions.assertEquals;
1919
import static org.junit.jupiter.api.Assertions.assertNull;
20-
import static org.mockito.Mockito.*;
20+
import static org.mockito.Mockito.never;
21+
import static org.mockito.Mockito.verify;
22+
import static org.mockito.Mockito.when;
2123

2224
import java.sql.Connection;
2325
import java.sql.SQLException;

src/test/java/org/apache/ibatis/transaction/jdbc/JdbcTransactionWithDataSourceTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
import static org.junit.jupiter.api.Assertions.assertEquals;
1919
import static org.junit.jupiter.api.Assertions.assertNull;
20-
import static org.mockito.Mockito.*;
20+
import static org.mockito.Mockito.never;
21+
import static org.mockito.Mockito.verify;
22+
import static org.mockito.Mockito.when;
2123

2224
import java.sql.Connection;
2325
import java.sql.SQLException;

src/test/java/org/apache/ibatis/transaction/managed/ManagedTransactionFactoryUnitTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
package org.apache.ibatis.transaction.managed;
1717

18-
import static org.junit.jupiter.api.Assertions.*;
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.assertFalse;
20+
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
21+
import static org.junit.jupiter.api.Assertions.assertNotNull;
1922
import static org.mockito.Mockito.verify;
2023
import static org.mockito.Mockito.when;
2124

src/test/java/org/apache/ibatis/transaction/managed/ManagedTransactionWithConnectionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void setup() {
4545
this.transaction = new ManagedTransaction(connection, true);
4646
}
4747

48+
@Override
4849
@Test
4950
void shouldGetConnection() throws SQLException {
5051
Connection result = transaction.getConnection();

src/test/java/org/apache/ibatis/transaction/managed/ManagedTransactionWithDataSourceTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
import static org.junit.jupiter.api.Assertions.assertEquals;
1919
import static org.junit.jupiter.api.Assertions.assertNull;
20-
import static org.mockito.Mockito.*;
20+
import static org.mockito.Mockito.never;
21+
import static org.mockito.Mockito.verify;
22+
import static org.mockito.Mockito.when;
2123

2224
import java.sql.Connection;
2325
import java.sql.SQLException;
@@ -50,6 +52,7 @@ void setup() {
5052
this.transaction = new ManagedTransaction(dataSource, TransactionIsolationLevel.READ_COMMITTED, true);
5153
}
5254

55+
@Override
5356
@Test
5457
void shouldGetConnection() throws SQLException {
5558
when(dataSource.getConnection()).thenReturn(connection);

0 commit comments

Comments
 (0)