Skip to content

Commit aaa5927

Browse files
authored
Merge pull request #3364 from hazendaz/pom-cleanup
Various test cleanup
2 parents 753591a + b244382 commit aaa5927

File tree

8 files changed

+14
-15
lines changed

8 files changed

+14
-15
lines changed

src/test/java/org/apache/ibatis/cache/PerpetualCacheTest.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.
@@ -75,7 +75,7 @@ void shouldFlushAllItemsOnDemand() {
7575
@Test
7676
void shouldDemonstrateIdIsNull() {
7777
Cache cache = new PerpetualCache(null);
78-
assertThrows(CacheException.class, () -> cache.hashCode());
78+
assertThrows(CacheException.class, cache::hashCode);
7979
assertThrows(CacheException.class, () -> cache.equals(new Object()));
8080
}
8181
}

src/test/java/org/apache/ibatis/io/ClassLoaderWrapperTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class ClassLoaderWrapperTest extends BaseDataTest {
2727

2828
private ClassLoaderWrapper wrapper;
2929
private ClassLoader loader;
30-
private final String RESOURCE_NOT_FOUND = "some_resource_that_does_not_exist.properties";
31-
private final String CLASS_NOT_FOUND = "some.random.class.that.does.not.Exist";
32-
private final String CLASS_FOUND = "java.lang.Object";
30+
private static final String RESOURCE_NOT_FOUND = "some_resource_that_does_not_exist.properties";
31+
private static final String CLASS_NOT_FOUND = "some.random.class.that.does.not.Exist";
32+
private static final String CLASS_FOUND = "java.lang.Object";
3333

3434
@BeforeEach
3535
void beforeClassLoaderWrapperTest() {

src/test/java/org/apache/ibatis/io/ExternalResourcesTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.apache.ibatis.io;
1717

18+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
1819
import static org.junit.jupiter.api.Assertions.assertEquals;
1920
import static org.junit.jupiter.api.Assertions.assertTrue;
2021
import static org.junit.jupiter.api.Assertions.fail;
@@ -49,11 +50,9 @@ void setUp() throws Exception {
4950

5051
@Test
5152
void testcopyExternalResource() {
52-
53-
try {
53+
assertDoesNotThrow(() -> {
5454
ExternalResources.copyExternalResource(sourceFile, destFile);
55-
} catch (IOException e) {
56-
}
55+
});
5756

5857
}
5958

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ interface Entity<T> {
5959
void setId(T id);
6060
}
6161

62-
static abstract class AbstractEntity implements Entity<Long> {
62+
abstract static class AbstractEntity implements Entity<Long> {
6363

6464
private Long id;
6565

@@ -137,7 +137,7 @@ void shouldResolveArrayGetterType() {
137137
assertEquals(String.class, clazz.getComponentType());
138138
}
139139

140-
static abstract class Parent<T extends Serializable> {
140+
abstract static class Parent<T extends Serializable> {
141141
protected T id;
142142
protected List<T> list;
143143
protected T[] array;

src/test/java/org/apache/ibatis/scripting/LanguageDriverRegistryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void setDefaultDriverClass() {
100100
assertThat(registry.getDefaultDriver()).isInstanceOf(RawLanguageDriver.class);
101101
}
102102

103-
static private class PrivateLanguageDriver implements LanguageDriver {
103+
private static class PrivateLanguageDriver implements LanguageDriver {
104104

105105
@Override
106106
public ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject,

src/test/java/org/apache/ibatis/submitted/cglib_lazy_error/CglibNPETest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void ancestorSelf() {
6464
}
6565

6666
@Test
67-
void testGrandParent() {
67+
void grandParent() {
6868
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
6969
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);
7070
Person expectedParent = personMapper.selectById(2);

src/test/java/org/apache/ibatis/submitted/null_associations/FooMapperTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
class FooMapperTest {
3333

34-
private final static String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/null_associations/sqlmap.xml";
34+
private static final String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/null_associations/sqlmap.xml";
3535
private static SqlSession session;
3636
private static Connection conn;
3737

src/test/java/org/apache/ibatis/submitted/overwritingproperties/FooMapperTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
class FooMapperTest {
3535

36-
private final static String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/overwritingproperties/sqlmap.xml";
36+
private static final String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/overwritingproperties/sqlmap.xml";
3737
private static SqlSession session;
3838
private static Connection conn;
3939

0 commit comments

Comments
 (0)