diff --git a/src/main/java/org/apache/ibatis/annotations/CacheNamespace.java b/src/main/java/org/apache/ibatis/annotations/CacheNamespace.java
index a7358a8ce13..37da2a1727f 100644
--- a/src/main/java/org/apache/ibatis/annotations/CacheNamespace.java
+++ b/src/main/java/org/apache/ibatis/annotations/CacheNamespace.java
@@ -25,6 +25,7 @@
import org.apache.ibatis.cache.decorators.LruCache;
import org.apache.ibatis.cache.impl.PerpetualCache;
+// @formatter:off
/**
* The annotation that specify to use cache on namespace(e.g. mapper interface).
*
@@ -44,6 +45,7 @@
* @author Clinton Begin
* @author Kazuki Shimizu
*/
+// @formatter:on
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
diff --git a/src/main/java/org/apache/ibatis/annotations/ConstructorArgs.java b/src/main/java/org/apache/ibatis/annotations/ConstructorArgs.java
index b3cc6bb888d..1df59aaa237 100644
--- a/src/main/java/org/apache/ibatis/annotations/ConstructorArgs.java
+++ b/src/main/java/org/apache/ibatis/annotations/ConstructorArgs.java
@@ -21,6 +21,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+// @formatter:off
/**
* The annotation that be grouping mapping definitions for constructor.
*
@@ -40,6 +41,7 @@
*
* @author Clinton Begin
*/
+// @formatter:on
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
diff --git a/src/main/java/org/apache/ibatis/annotations/DeleteProvider.java b/src/main/java/org/apache/ibatis/annotations/DeleteProvider.java
index 5ae9043875a..a0f6331002e 100644
--- a/src/main/java/org/apache/ibatis/annotations/DeleteProvider.java
+++ b/src/main/java/org/apache/ibatis/annotations/DeleteProvider.java
@@ -73,10 +73,12 @@
*/
Class> type() default void.class;
+ // @formatter:off
/**
* Specify a method for providing an SQL.
*
* Since 3.5.1, this attribute can omit.
+ *
* If this attribute omit, the MyBatis will call a method that decide by following rules.
*
* -
@@ -92,6 +94,7 @@
*
* @return a method name of method for providing an SQL
*/
+ // @formatter:on
String method() default "";
/**
diff --git a/src/main/java/org/apache/ibatis/annotations/InsertProvider.java b/src/main/java/org/apache/ibatis/annotations/InsertProvider.java
index 71c8b5406ee..d97959e0e9b 100644
--- a/src/main/java/org/apache/ibatis/annotations/InsertProvider.java
+++ b/src/main/java/org/apache/ibatis/annotations/InsertProvider.java
@@ -73,10 +73,12 @@
*/
Class> type() default void.class;
+ // @formatter:off
/**
* Specify a method for providing an SQL.
*
* Since 3.5.1, this attribute can omit.
+ *
* If this attribute omit, the MyBatis will call a method that decide by following rules.
*
* -
@@ -92,6 +94,7 @@
*
* @return a method name of method for providing an SQL
*/
+ // @formatter:on
String method() default "";
/**
diff --git a/src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java b/src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java
index 230c16c41db..d0fc3c7fdf8 100644
--- a/src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java
+++ b/src/main/java/org/apache/ibatis/builder/annotation/ProviderMethodResolver.java
@@ -39,8 +39,8 @@ public interface ProviderMethodResolver {
*
* The default implementation return a method that matches following conditions.
*
- * - Method name matches with mapper method
- * - Return type matches the {@link CharSequence}({@link String}, {@link StringBuilder}, etc...)
+ * - Method name matches with mapper method
+ * - Return type matches the {@link CharSequence}({@link String}, {@link StringBuilder}, etc...)
*
* If matched method is zero or multiple, it throws a {@link BuilderException}.
*
diff --git a/src/main/java/org/apache/ibatis/jdbc/Null.java b/src/main/java/org/apache/ibatis/jdbc/Null.java
index 932e38e7031..5843cbd6c81 100644
--- a/src/main/java/org/apache/ibatis/jdbc/Null.java
+++ b/src/main/java/org/apache/ibatis/jdbc/Null.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -45,28 +45,45 @@ public enum Null {
BOOLEAN(new BooleanTypeHandler(), JdbcType.BOOLEAN),
BYTE(new ByteTypeHandler(), JdbcType.TINYINT),
+
SHORT(new ShortTypeHandler(), JdbcType.SMALLINT),
+
INTEGER(new IntegerTypeHandler(), JdbcType.INTEGER),
+
LONG(new LongTypeHandler(), JdbcType.BIGINT),
+
FLOAT(new FloatTypeHandler(), JdbcType.FLOAT),
+
DOUBLE(new DoubleTypeHandler(), JdbcType.DOUBLE),
+
BIGDECIMAL(new BigDecimalTypeHandler(), JdbcType.DECIMAL),
STRING(new StringTypeHandler(), JdbcType.VARCHAR),
+
CLOB(new ClobTypeHandler(), JdbcType.CLOB),
+
LONGVARCHAR(new ClobTypeHandler(), JdbcType.LONGVARCHAR),
BYTEARRAY(new ByteArrayTypeHandler(), JdbcType.LONGVARBINARY),
+
BLOB(new BlobTypeHandler(), JdbcType.BLOB),
+
LONGVARBINARY(new BlobTypeHandler(), JdbcType.LONGVARBINARY),
OBJECT(new ObjectTypeHandler(), JdbcType.OTHER),
+
OTHER(new ObjectTypeHandler(), JdbcType.OTHER),
+
TIMESTAMP(new DateTypeHandler(), JdbcType.TIMESTAMP),
+
DATE(new DateOnlyTypeHandler(), JdbcType.DATE),
+
TIME(new TimeOnlyTypeHandler(), JdbcType.TIME),
+
SQLTIMESTAMP(new SqlTimestampTypeHandler(), JdbcType.TIMESTAMP),
+
SQLDATE(new SqlDateTypeHandler(), JdbcType.DATE),
+
SQLTIME(new SqlTimeTypeHandler(), JdbcType.TIME);
private final TypeHandler> typeHandler;
diff --git a/src/main/java/org/apache/ibatis/mapping/ResultSetType.java b/src/main/java/org/apache/ibatis/mapping/ResultSetType.java
index a9dbd34ee54..f7c235c3562 100644
--- a/src/main/java/org/apache/ibatis/mapping/ResultSetType.java
+++ b/src/main/java/org/apache/ibatis/mapping/ResultSetType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -26,9 +26,7 @@ public enum ResultSetType {
*
* @since 3.5.0
*/
- DEFAULT(-1),
- FORWARD_ONLY(ResultSet.TYPE_FORWARD_ONLY),
- SCROLL_INSENSITIVE(ResultSet.TYPE_SCROLL_INSENSITIVE),
+ DEFAULT(-1), FORWARD_ONLY(ResultSet.TYPE_FORWARD_ONLY), SCROLL_INSENSITIVE(ResultSet.TYPE_SCROLL_INSENSITIVE),
SCROLL_SENSITIVE(ResultSet.TYPE_SCROLL_SENSITIVE);
private final int value;
diff --git a/src/main/java/org/apache/ibatis/type/JdbcType.java b/src/main/java/org/apache/ibatis/type/JdbcType.java
index b6ce8f8628f..60cc7f150ae 100644
--- a/src/main/java/org/apache/ibatis/type/JdbcType.java
+++ b/src/main/java/org/apache/ibatis/type/JdbcType.java
@@ -24,49 +24,88 @@
*/
public enum JdbcType {
/*
- * This is added to enable basic support for the
- * ARRAY data type - but a custom type handler is still required
+ * This is added to enable basic support for the ARRAY data type - but a custom type handler is still required
*/
ARRAY(Types.ARRAY),
+
BIT(Types.BIT),
+
TINYINT(Types.TINYINT),
+
SMALLINT(Types.SMALLINT),
+
INTEGER(Types.INTEGER),
+
BIGINT(Types.BIGINT),
+
FLOAT(Types.FLOAT),
+
REAL(Types.REAL),
+
DOUBLE(Types.DOUBLE),
+
NUMERIC(Types.NUMERIC),
+
DECIMAL(Types.DECIMAL),
+
CHAR(Types.CHAR),
+
VARCHAR(Types.VARCHAR),
+
LONGVARCHAR(Types.LONGVARCHAR),
+
DATE(Types.DATE),
+
TIME(Types.TIME),
+
TIMESTAMP(Types.TIMESTAMP),
+
BINARY(Types.BINARY),
+
VARBINARY(Types.VARBINARY),
+
LONGVARBINARY(Types.LONGVARBINARY),
+
NULL(Types.NULL),
+
OTHER(Types.OTHER),
+
BLOB(Types.BLOB),
+
CLOB(Types.CLOB),
+
BOOLEAN(Types.BOOLEAN),
+
CURSOR(-10), // Oracle
+
UNDEFINED(Integer.MIN_VALUE + 1000),
+
NVARCHAR(Types.NVARCHAR), // JDK6
+
NCHAR(Types.NCHAR), // JDK6
+
NCLOB(Types.NCLOB), // JDK6
+
STRUCT(Types.STRUCT),
+
JAVA_OBJECT(Types.JAVA_OBJECT),
+
DISTINCT(Types.DISTINCT),
+
REF(Types.REF),
+
DATALINK(Types.DATALINK),
+
ROWID(Types.ROWID), // JDK6
+
LONGNVARCHAR(Types.LONGNVARCHAR), // JDK6
+
SQLXML(Types.SQLXML), // JDK6
+
DATETIMEOFFSET(-155), // SQL Server 2008
+
TIME_WITH_TIMEZONE(Types.TIME_WITH_TIMEZONE), // JDBC 4.2 JDK8
+
TIMESTAMP_WITH_TIMEZONE(Types.TIMESTAMP_WITH_TIMEZONE); // JDBC 4.2 JDK8
public final int TYPE_CODE;
diff --git a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java
index 360cefebdcc..2d166c81182 100644
--- a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java
+++ b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java
@@ -96,14 +96,16 @@ void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception {
assertThat(config.isSafeRowBoundsEnabled()).isFalse();
assertThat(config.getLocalCacheScope()).isEqualTo(LocalCacheScope.SESSION);
assertThat(config.getJdbcTypeForNull()).isEqualTo(JdbcType.OTHER);
- assertThat(config.getLazyLoadTriggerMethods()).isEqualTo(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString")));
+ assertThat(config.getLazyLoadTriggerMethods())
+ .isEqualTo(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString")));
assertThat(config.isSafeResultHandlerEnabled()).isTrue();
assertThat(config.getDefaultScriptingLanuageInstance()).isInstanceOf(XMLLanguageDriver.class);
assertThat(config.isCallSettersOnNulls()).isFalse();
assertNull(config.getLogPrefix());
assertNull(config.getLogImpl());
assertNull(config.getConfigurationFactory());
- assertThat(config.getTypeHandlerRegistry().getTypeHandler(RoundingMode.class)).isInstanceOf(EnumTypeHandler.class);
+ assertThat(config.getTypeHandlerRegistry().getTypeHandler(RoundingMode.class))
+ .isInstanceOf(EnumTypeHandler.class);
assertThat(config.isShrinkWhitespacesInSql()).isFalse();
assertThat(config.isArgNameBasedConstructorAutoMapping()).isFalse();
assertThat(config.getDefaultSqlProviderType()).isNull();
@@ -195,7 +197,8 @@ void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
assertThat(config.isSafeRowBoundsEnabled()).isTrue();
assertThat(config.getLocalCacheScope()).isEqualTo(LocalCacheScope.STATEMENT);
assertThat(config.getJdbcTypeForNull()).isEqualTo(JdbcType.NULL);
- assertThat(config.getLazyLoadTriggerMethods()).isEqualTo(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx")));
+ assertThat(config.getLazyLoadTriggerMethods())
+ .isEqualTo(new HashSet<>(Arrays.asList("equals", "clone", "hashCode", "toString", "xxx")));
assertThat(config.isSafeResultHandlerEnabled()).isFalse();
assertThat(config.getDefaultScriptingLanuageInstance()).isInstanceOf(RawLanguageDriver.class);
assertThat(config.isCallSettersOnNulls()).isTrue();
@@ -212,11 +215,15 @@ void shouldSuccessfullyLoadXMLConfigFile() throws Exception {
assertThat(config.getTypeAliasRegistry().getTypeAliases().get("blog")).isEqualTo(Blog.class);
assertThat(config.getTypeAliasRegistry().getTypeAliases().get("cart")).isEqualTo(Cart.class);
- assertThat(config.getTypeHandlerRegistry().getTypeHandler(Integer.class)).isInstanceOf(CustomIntegerTypeHandler.class);
+ assertThat(config.getTypeHandlerRegistry().getTypeHandler(Integer.class))
+ .isInstanceOf(CustomIntegerTypeHandler.class);
assertThat(config.getTypeHandlerRegistry().getTypeHandler(Long.class)).isInstanceOf(CustomLongTypeHandler.class);
- assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class)).isInstanceOf(CustomStringTypeHandler.class);
- assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class, JdbcType.VARCHAR)).isInstanceOf(CustomStringTypeHandler.class);
- assertThat(config.getTypeHandlerRegistry().getTypeHandler(RoundingMode.class)).isInstanceOf(EnumOrdinalTypeHandler.class);
+ assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class))
+ .isInstanceOf(CustomStringTypeHandler.class);
+ assertThat(config.getTypeHandlerRegistry().getTypeHandler(String.class, JdbcType.VARCHAR))
+ .isInstanceOf(CustomStringTypeHandler.class);
+ assertThat(config.getTypeHandlerRegistry().getTypeHandler(RoundingMode.class))
+ .isInstanceOf(EnumOrdinalTypeHandler.class);
ExampleObjectFactory objectFactory = (ExampleObjectFactory) config.getObjectFactory();
assertThat(objectFactory.getProperties().size()).isEqualTo(1);
@@ -265,7 +272,7 @@ void parseIsTwice() throws Exception {
when(builder::parse);
then(caughtException()).isInstanceOf(BuilderException.class)
- .hasMessage("Each XMLConfigBuilder can only be used once.");
+ .hasMessage("Each XMLConfigBuilder can only be used once.");
}
}
@@ -282,7 +289,7 @@ void unknownSettings() {
XMLConfigBuilder builder = new XMLConfigBuilder(new StringReader(MAPPER_CONFIG));
when(builder::parse);
then(caughtException()).isInstanceOf(BuilderException.class)
- .hasMessageContaining("The setting foo is not known. Make sure you spelled it correctly (case sensitive).");
+ .hasMessageContaining("The setting foo is not known. Make sure you spelled it correctly (case sensitive).");
}
@Test
@@ -337,8 +344,8 @@ void shouldAllowSubclassedConfiguration() throws IOException {
void noDefaultConstructorForSubclassedConfiguration() throws IOException {
String resource = "org/apache/ibatis/builder/MinimalMapperConfig.xml";
try (InputStream inputStream = Resources.getResourceAsStream(resource)) {
- Exception exception = Assertions.assertThrows(Exception.class, () -> new XMLConfigBuilder(
- BadConfiguration.class, inputStream, null, null));
+ Exception exception = Assertions.assertThrows(Exception.class,
+ () -> new XMLConfigBuilder(BadConfiguration.class, inputStream, null, null));
assertEquals("Failed to create a new Configuration instance.", exception.getMessage());
}
}
diff --git a/src/test/java/org/apache/ibatis/jdbc/ScriptRunnerTest.java b/src/test/java/org/apache/ibatis/jdbc/ScriptRunnerTest.java
index d3ac8212374..74904d75ffb 100644
--- a/src/test/java/org/apache/ibatis/jdbc/ScriptRunnerTest.java
+++ b/src/test/java/org/apache/ibatis/jdbc/ScriptRunnerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -77,11 +77,8 @@ void shouldRunScriptsUsingConnection() throws Exception {
@Test
void shouldRunScriptsUsingProperties() throws Exception {
Properties props = Resources.getResourceAsProperties(JPETSTORE_PROPERTIES);
- DataSource dataSource = new UnpooledDataSource(
- props.getProperty("driver"),
- props.getProperty("url"),
- props.getProperty("username"),
- props.getProperty("password"));
+ DataSource dataSource = new UnpooledDataSource(props.getProperty("driver"), props.getProperty("url"),
+ props.getProperty("username"), props.getProperty("password"));
ScriptRunner runner = new ScriptRunner(dataSource.getConnection());
runner.setAutoCommit(true);
runner.setStopOnError(false);
@@ -95,8 +92,7 @@ void shouldRunScriptsUsingProperties() throws Exception {
void shouldReturnWarningIfEndOfLineTerminatorNotFound() throws Exception {
DataSource ds = createUnpooledDataSource(JPETSTORE_PROPERTIES);
String resource = "org/apache/ibatis/jdbc/ScriptMissingEOLTerminator.sql";
- try (Connection conn = ds.getConnection();
- Reader reader = Resources.getResourceAsReader(resource)) {
+ try (Connection conn = ds.getConnection(); Reader reader = Resources.getResourceAsReader(resource)) {
ScriptRunner runner = new ScriptRunner(conn);
runner.setAutoCommit(true);
runner.setStopOnError(false);
@@ -116,8 +112,7 @@ void shouldReturnWarningIfEndOfLineTerminatorNotFound() throws Exception {
void commentAferStatementDelimiterShouldNotCauseRunnerFail() throws Exception {
DataSource ds = createUnpooledDataSource(JPETSTORE_PROPERTIES);
String resource = "org/apache/ibatis/jdbc/ScriptCommentAfterEOLTerminator.sql";
- try (Connection conn = ds.getConnection();
- Reader reader = Resources.getResourceAsReader(resource)) {
+ try (Connection conn = ds.getConnection(); Reader reader = Resources.getResourceAsReader(resource)) {
ScriptRunner runner = new ScriptRunner(conn);
runner.setAutoCommit(true);
runner.setStopOnError(true);
@@ -132,8 +127,7 @@ void commentAferStatementDelimiterShouldNotCauseRunnerFail() throws Exception {
void shouldReturnWarningIfNotTheCurrentDelimiterUsed() throws Exception {
DataSource ds = createUnpooledDataSource(JPETSTORE_PROPERTIES);
String resource = "org/apache/ibatis/jdbc/ScriptChangingDelimiterMissingDelimiter.sql";
- try (Connection conn = ds.getConnection();
- Reader reader = Resources.getResourceAsReader(resource)) {
+ try (Connection conn = ds.getConnection(); Reader reader = Resources.getResourceAsReader(resource)) {
ScriptRunner runner = new ScriptRunner(conn);
runner.setAutoCommit(false);
runner.setStopOnError(true);
@@ -152,8 +146,7 @@ void shouldReturnWarningIfNotTheCurrentDelimiterUsed() throws Exception {
void changingDelimiterShouldNotCauseRunnerFail() throws Exception {
DataSource ds = createUnpooledDataSource(JPETSTORE_PROPERTIES);
String resource = "org/apache/ibatis/jdbc/ScriptChangingDelimiter.sql";
- try (Connection conn = ds.getConnection();
- Reader reader = Resources.getResourceAsReader(resource)) {
+ try (Connection conn = ds.getConnection(); Reader reader = Resources.getResourceAsReader(resource)) {
ScriptRunner runner = new ScriptRunner(conn);
runner.setAutoCommit(false);
runner.setStopOnError(true);
@@ -180,10 +173,8 @@ void testLogging() throws Exception {
Reader reader = new StringReader("select userid from account where userid = 'j2ee';");
runner.runScript(reader);
- assertEquals(
- "select userid from account where userid = 'j2ee'" + LINE_SEPARATOR
- + LINE_SEPARATOR + "USERID\t" + LINE_SEPARATOR
- + "j2ee\t" + LINE_SEPARATOR, sw.toString());
+ assertEquals("select userid from account where userid = 'j2ee'" + LINE_SEPARATOR + LINE_SEPARATOR + "USERID\t"
+ + LINE_SEPARATOR + "j2ee\t" + LINE_SEPARATOR, sw.toString());
}
}
@@ -203,10 +194,8 @@ void testLoggingFullScipt() throws Exception {
Reader reader = new StringReader("select userid from account where userid = 'j2ee';");
runner.runScript(reader);
- assertEquals(
- "select userid from account where userid = 'j2ee';" + LINE_SEPARATOR
- + LINE_SEPARATOR + "USERID\t" + LINE_SEPARATOR
- + "j2ee\t" + LINE_SEPARATOR, sw.toString());
+ assertEquals("select userid from account where userid = 'j2ee';" + LINE_SEPARATOR + LINE_SEPARATOR + "USERID\t"
+ + LINE_SEPARATOR + "j2ee\t" + LINE_SEPARATOR, sw.toString());
}
}
@@ -234,20 +223,13 @@ void shouldAcceptDelimiterVariations() throws Exception {
when(stmt.getUpdateCount()).thenReturn(-1);
ScriptRunner runner = new ScriptRunner(conn);
- String sql = "-- @DELIMITER | \n"
- + "line 1;\n"
- + "line 2;\n"
- + "|\n"
- + "// @DELIMITER ;\n"
- + "line 3; \n"
- + "-- //@deLimiTer $ blah\n"
- + "line 4$\n"
- + "// //@DELIMITER %\n"
- + "line 5%\n";
+ String sql = "-- @DELIMITER | \n" + "line 1;\n" + "line 2;\n" + "|\n" + "// @DELIMITER ;\n" + "line 3; \n"
+ + "-- //@deLimiTer $ blah\n" + "line 4$\n" + "// //@DELIMITER %\n" + "line 5%\n";
Reader reader = new StringReader(sql);
runner.runScript(reader);
- verify(stmt, Mockito.times(1)).execute(eq("line 1;" + LINE_SEPARATOR + "line 2;" + LINE_SEPARATOR + LINE_SEPARATOR));
+ verify(stmt, Mockito.times(1))
+ .execute(eq("line 1;" + LINE_SEPARATOR + "line 2;" + LINE_SEPARATOR + LINE_SEPARATOR));
verify(stmt, Mockito.times(1)).execute(eq("line 3" + LINE_SEPARATOR));
verify(stmt, Mockito.times(1)).execute(eq("line 4" + LINE_SEPARATOR));
verify(stmt, Mockito.times(1)).execute(eq("line 5" + LINE_SEPARATOR));
@@ -273,16 +255,12 @@ void shouldAcceptMultiCharDelimiter() throws Exception {
when(stmt.getUpdateCount()).thenReturn(-1);
ScriptRunner runner = new ScriptRunner(conn);
- String sql = "-- @DELIMITER || \n"
- + "line 1;\n"
- + "line 2;\n"
- + "||\n"
- + "// @DELIMITER ;\n"
- + "line 3; \n";
+ String sql = "-- @DELIMITER || \n" + "line 1;\n" + "line 2;\n" + "||\n" + "// @DELIMITER ;\n" + "line 3; \n";
Reader reader = new StringReader(sql);
runner.runScript(reader);
- verify(stmt, Mockito.times(1)).execute(eq("line 1;" + LINE_SEPARATOR + "line 2;" + LINE_SEPARATOR + LINE_SEPARATOR));
+ verify(stmt, Mockito.times(1))
+ .execute(eq("line 1;" + LINE_SEPARATOR + "line 2;" + LINE_SEPARATOR + LINE_SEPARATOR));
verify(stmt, Mockito.times(1)).execute(eq("line 3" + LINE_SEPARATOR));
}
}
diff --git a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/Role.java b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/Role.java
index 0ade0c71651..110659ce8b7 100644
--- a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/Role.java
+++ b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/Role.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -20,10 +20,7 @@ public class Role {
@Override
public String toString() {
- return "Role{" +
- "id=" + id +
- ", roleName='" + name + '\'' +
- '}';
+ return "Role{" + "id=" + id + ", roleName='" + name + '\'' + '}';
}
private String name;
diff --git a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/User.java b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/User.java
index 3bc9035913f..4ea300b5d6c 100644
--- a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/User.java
+++ b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_columnprefix/User.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -35,11 +35,7 @@ public void setRole(Role role) {
@Override
public String toString() {
- return "User{" +
- "id=" + id +
- ", username='" + username + '\'' +
- ", roles=" + roles +
- '}';
+ return "User{" + "id=" + id + ", username='" + username + '\'' + ", roles=" + roles + '}';
}
public Integer getId() {
diff --git a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/Role.java b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/Role.java
index 505afc3ca9b..9d48e1d34ec 100644
--- a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/Role.java
+++ b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/Role.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -20,10 +20,7 @@ public class Role {
@Override
public String toString() {
- return "Role{" +
- "id=" + id +
- ", roleName='" + roleName + '\'' +
- '}';
+ return "Role{" + "id=" + id + ", roleName='" + roleName + '\'' + '}';
}
private String roleName;
diff --git a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/User.java b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/User.java
index 664033fd09d..c35092d2756 100644
--- a/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/User.java
+++ b/src/test/java/org/apache/ibatis/submitted/annotion_many_one_add_resultmapid/User.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -34,11 +34,7 @@ public void setRole(Role role) {
@Override
public String toString() {
- return "User{" +
- "id=" + id +
- ", username='" + username + '\'' +
- ", roles=" + roles +
- '}';
+ return "User{" + "id=" + id + ", username='" + username + '\'' + ", roles=" + roles + '}';
}
public Integer getId() {
diff --git a/src/test/java/org/apache/ibatis/submitted/association_nested/FolderFlatTree.java b/src/test/java/org/apache/ibatis/submitted/association_nested/FolderFlatTree.java
index 06882533870..16f7a103420 100644
--- a/src/test/java/org/apache/ibatis/submitted/association_nested/FolderFlatTree.java
+++ b/src/test/java/org/apache/ibatis/submitted/association_nested/FolderFlatTree.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -26,8 +26,6 @@ public class FolderFlatTree {
@Override
public String toString() {
- return root
- + "\n\t" + level1
- + "\n\t\t" + level2;
+ return root + "\n\t" + level1 + "\n\t\t" + level2;
}
}
diff --git a/src/test/java/org/apache/ibatis/submitted/association_nested/FolderMapperTest.java b/src/test/java/org/apache/ibatis/submitted/association_nested/FolderMapperTest.java
index 053696c4847..454c1669523 100644
--- a/src/test/java/org/apache/ibatis/submitted/association_nested/FolderMapperTest.java
+++ b/src/test/java/org/apache/ibatis/submitted/association_nested/FolderMapperTest.java
@@ -46,13 +46,14 @@ void testFindWithChildren() throws Exception {
}
/**
+ *
* Root/
- * Folder 1/
- * Folder 2/
- * Folder 2_1
- * Folder 2_2
+ * Folder 1/
+ * Folder 2/
+ * Folder 2_1
+ * Folder 2_2
+ *
*/
-
String resource = "org/apache/ibatis/submitted/association_nested/mybatis-config.xml";
try (InputStream inputStream = Resources.getResourceAsStream(resource)) {
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
diff --git a/src/test/java/org/apache/ibatis/submitted/heavy_initial_load/HeavyInitialLoadTest.java b/src/test/java/org/apache/ibatis/submitted/heavy_initial_load/HeavyInitialLoadTest.java
index a8de042bade..be32e1c2922 100644
--- a/src/test/java/org/apache/ibatis/submitted/heavy_initial_load/HeavyInitialLoadTest.java
+++ b/src/test/java/org/apache/ibatis/submitted/heavy_initial_load/HeavyInitialLoadTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2022 the original author or authors.
+ * Copyright 2009-2023 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.
@@ -45,18 +45,16 @@ static void initSqlSessionFactory() throws Exception {
private static final int THREAD_COUNT = 5;
/**
- * Test to demonstrate the effect of the
- * https://issues.apache.org/jira/browse/OGNL-121 issue in ognl on mybatis.
- *
- * Use the thing mapper for the first time in multiple threads. The mapper contains
- * a lot of ognl references to static final class members like:
- *
+ * Test to demonstrate the effect of the https://issues.apache.org/jira/browse/OGNL-121 issue in ognl on mybatis.
+ *
+ * Use the thing mapper for the first time in multiple threads. The mapper contains a lot of ognl references to
+ * static final class members like:
+ *
* @org.apache.ibatis.submitted.heavy_initial_load.Code@_1.equals(code)
- *
- * Handling of these references is optimized in ognl (because they never change), but
- * version 2.6.9 has a bug in caching the result . As a result the reference is
- * translated to a 'null' value, which is used to invoke the 'equals' method on
- * (hence the 'target is null for method equals' exception).
+ *
+ * Handling of these references is optimized in ognl (because they never change), but version 2.6.9 has a bug in
+ * caching the result . As a result the reference is translated to a 'null' value, which is used to invoke the
+ * 'equals' method on (hence the 'target is null for method equals' exception).
*/
@Test
void selectThingsConcurrently_mybatis_issue_224() throws Exception {