Skip to content

Commit 2fb75f5

Browse files
committed
tests: Use final and add constructor where needed
1 parent 5d995de commit 2fb75f5

File tree

21 files changed

+42
-39
lines changed

21 files changed

+42
-39
lines changed

src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void propertiesSpecifyResourceAndUrlAtSameTime() {
333333
"The properties element cannot specify both a URL and a resource based property file reference. Please specify one or the other.");
334334
}
335335

336-
static class MySqlProvider {
336+
static final class MySqlProvider {
337337
@SuppressWarnings("unused")
338338
public static String provideSql() {
339339
return "SELECT 1";

src/test/java/org/apache/ibatis/databases/blog/StoredProcedures.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.
@@ -21,7 +21,7 @@
2121
import java.sql.ResultSet;
2222
import java.sql.SQLException;
2323

24-
public class StoredProcedures {
24+
public final class StoredProcedures {
2525
public static void selectTwoSetsOfTwoAuthors(int p1, int p2, ResultSet[] rs1, ResultSet[] rs2) throws SQLException {
2626
try (Connection conn = DriverManager.getConnection("jdbc:default:connection")) {
2727
PreparedStatement ps1 = conn.prepareStatement("select * from author where id in (?,?)");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
import org.apache.ibatis.type.JdbcType;
5454
import org.apache.ibatis.type.TypeHandlerRegistry;
5555

56-
class ExecutorTestHelper {
56+
final class ExecutorTestHelper {
5757

5858
static final Cache authorCache;
5959

src/test/java/org/apache/ibatis/plugin/PluginTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void shouldPluginSwitchSchema() {
6060
}
6161
}
6262

63-
static class SchemaHolder {
63+
static final class SchemaHolder {
6464
private static ThreadLocal<String> value = ThreadLocal.withInitial(() -> "PUBLIC");
6565

6666
public static void set(String tenantName) {
@@ -70,6 +70,9 @@ public static void set(String tenantName) {
7070
public static String get() {
7171
return value.get();
7272
}
73+
74+
private SchemaHolder() {
75+
}
7376
}
7477

7578
@Intercepts(@Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class, Integer.class }))

src/test/java/org/apache/ibatis/submitted/constructor_automapping/Author.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.
@@ -15,7 +15,7 @@
1515
*/
1616
package org.apache.ibatis.submitted.constructor_automapping;
1717

18-
public class Author {
18+
public final class Author {
1919

2020
private final Integer id;
2121
private String name;

src/test/java/org/apache/ibatis/submitted/dirty_select/Mapper.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.
@@ -44,7 +44,7 @@ public interface Mapper {
4444
@Insert("insert into users (name) values (#{name}) returning id, name")
4545
int insert(User user);
4646

47-
static class MyProvider {
47+
static final class MyProvider {
4848
public static String getSql() {
4949
return "insert into users (name) values (#{name}) returning id, name";
5050
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
package org.apache.ibatis.submitted.discriminator;
1717

1818
public class Contract {
19-
private Integer id;
20-
private Owner owner;
19+
private final Integer id;
20+
private final Owner owner;
2121

2222
public Contract(Integer id, Owner owner) {
2323
this.id = id;

src/test/java/org/apache/ibatis/submitted/dynsql/CustomUtil.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.
@@ -15,7 +15,7 @@
1515
*/
1616
package org.apache.ibatis.submitted.dynsql;
1717

18-
public class CustomUtil {
18+
public final class CustomUtil {
1919
public static String esc(final String s) {
2020
return s.replace("'", "''");
2121
}

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
@@ -29,7 +29,7 @@ public String getMessage() {
2929
}
3030
};
3131

32-
private int value;
32+
private final int value;
3333

3434
Mood(int value) {
3535
this.value = value;

src/test/java/org/apache/ibatis/submitted/global_variables_defaults/SupportClasses.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 void setName(String name) {
5454
}
5555
}
5656

57-
static class Utils {
57+
static final class Utils {
5858
static SupportClasses.CustomCache unwrap(Cache cache) {
5959
Field field;
6060
try {

0 commit comments

Comments
 (0)