Skip to content

Various test cleanup #3364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/test/java/org/apache/ibatis/cache/PerpetualCacheTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2023 the original author or authors.
* Copyright 2009-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,7 +75,7 @@ void shouldFlushAllItemsOnDemand() {
@Test
void shouldDemonstrateIdIsNull() {
Cache cache = new PerpetualCache(null);
assertThrows(CacheException.class, () -> cache.hashCode());
assertThrows(CacheException.class, cache::hashCode);
assertThrows(CacheException.class, () -> cache.equals(new Object()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class ClassLoaderWrapperTest extends BaseDataTest {

private ClassLoaderWrapper wrapper;
private ClassLoader loader;
private final String RESOURCE_NOT_FOUND = "some_resource_that_does_not_exist.properties";
private final String CLASS_NOT_FOUND = "some.random.class.that.does.not.Exist";
private final String CLASS_FOUND = "java.lang.Object";
private static final String RESOURCE_NOT_FOUND = "some_resource_that_does_not_exist.properties";
private static final String CLASS_NOT_FOUND = "some.random.class.that.does.not.Exist";
private static final String CLASS_FOUND = "java.lang.Object";

@BeforeEach
void beforeClassLoaderWrapperTest() {
Expand Down
7 changes: 3 additions & 4 deletions src/test/java/org/apache/ibatis/io/ExternalResourcesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.apache.ibatis.io;

import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
Expand Down Expand Up @@ -49,11 +50,9 @@ void setUp() throws Exception {

@Test
void testcopyExternalResource() {

try {
assertDoesNotThrow(() -> {
ExternalResources.copyExternalResource(sourceFile, destFile);
} catch (IOException e) {
}
});

}

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/apache/ibatis/reflection/ReflectorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ interface Entity<T> {
void setId(T id);
}

static abstract class AbstractEntity implements Entity<Long> {
abstract static class AbstractEntity implements Entity<Long> {

private Long id;

Expand Down Expand Up @@ -137,7 +137,7 @@ void shouldResolveArrayGetterType() {
assertEquals(String.class, clazz.getComponentType());
}

static abstract class Parent<T extends Serializable> {
abstract static class Parent<T extends Serializable> {
protected T id;
protected List<T> list;
protected T[] array;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void setDefaultDriverClass() {
assertThat(registry.getDefaultDriver()).isInstanceOf(RawLanguageDriver.class);
}

static private class PrivateLanguageDriver implements LanguageDriver {
private static class PrivateLanguageDriver implements LanguageDriver {

@Override
public ParameterHandler createParameterHandler(MappedStatement mappedStatement, Object parameterObject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void ancestorSelf() {
}

@Test
void testGrandParent() {
void grandParent() {
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
PersonMapper personMapper = sqlSession.getMapper(PersonMapper.class);
Person expectedParent = personMapper.selectById(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class FooMapperTest {

private final static String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/null_associations/sqlmap.xml";
private static final String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/null_associations/sqlmap.xml";
private static SqlSession session;
private static Connection conn;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
class FooMapperTest {

private final static String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/overwritingproperties/sqlmap.xml";
private static final String SQL_MAP_CONFIG = "org/apache/ibatis/submitted/overwritingproperties/sqlmap.xml";
private static SqlSession session;
private static Connection conn;

Expand Down
Loading