Skip to content

Commit

Permalink
Format by maven plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
harawata committed Oct 31, 2023
1 parent a6e47d8 commit f1ba3d5
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/test/java/org/apache/ibatis/cache/LruCacheTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.lang.reflect.Field;
import java.util.Map;

import org.apache.ibatis.cache.decorators.LruCache;
import org.apache.ibatis.cache.impl.PerpetualCache;
import org.junit.jupiter.api.Test;

import java.lang.reflect.Field;
import java.util.Map;

class LruCacheTest {

@Test
Expand Down
18 changes: 12 additions & 6 deletions src/test/java/org/apache/ibatis/executor/BaseExecutorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@ void shouldClearDeferredLoads() throws Exception {
void testCreateCacheKeyWithAdditionalParameter() {
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Object parameterObject = 1;

Expand Down Expand Up @@ -513,7 +514,8 @@ void testCreateCacheKeyWithAdditionalParameter() {
void testCreateCacheKeyWithNull() {
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Object parameterObject = null;

Expand All @@ -540,7 +542,8 @@ void testCreateCacheKeyWithNull() {
void testCreateCacheKeyWithTypeHandler() {
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Object parameterObject = 1;

Expand All @@ -567,7 +570,8 @@ void testCreateCacheKeyWithTypeHandler() {
void testCreateCacheKeyWithMetaObject() {
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Author parameterObject = new Author(-1, "cbegin", "******", "cbegin@nowhere.com", "N/A", Section.NEWS);

Expand All @@ -577,8 +581,10 @@ void testCreateCacheKeyWithMetaObject() {
add(new ParameterMapping.Builder(config, "username", registry.getTypeHandler(String.class)).build());
add(new ParameterMapping.Builder(config, "password", registry.getTypeHandler(String.class)).build());
add(new ParameterMapping.Builder(config, "email", registry.getTypeHandler(String.class)).build());
add(new ParameterMapping.Builder(config, "bio", registry.getTypeHandler(String.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(config, "favouriteSection", registry.getTypeHandler(Section.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(config, "bio", registry.getTypeHandler(String.class))
.jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(config, "favouriteSection", registry.getTypeHandler(Section.class))
.jdbcType(JdbcType.VARCHAR).build());
}
}, parameterObject);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ void testParameterObjectGetPropertyValueWithAdditionalParameter() throws SQLExce
Configuration config = new Configuration();
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Object parameterObject = 1;

Expand All @@ -129,7 +130,8 @@ void testParameterObjectGetPropertyValueWithAdditionalParameter() throws SQLExce
}
};

DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject, boundSql);
DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject,
boundSql);

PreparedStatement ps = mock(PreparedStatement.class);

Expand All @@ -143,7 +145,8 @@ void testParameterObjectGetPropertyValueWithNull() throws SQLException {
Configuration config = new Configuration();
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Object parameterObject = null;

Expand All @@ -153,7 +156,8 @@ void testParameterObjectGetPropertyValueWithNull() throws SQLException {
}
}, parameterObject);

DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject, boundSql);
DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject,
boundSql);

PreparedStatement ps = mock(PreparedStatement.class);

Expand All @@ -167,7 +171,8 @@ void testParameterObjectGetPropertyValueWithTypeHandler() throws SQLException {
Configuration config = new Configuration();
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Object parameterObject = 1;

Expand All @@ -177,7 +182,8 @@ void testParameterObjectGetPropertyValueWithTypeHandler() throws SQLException {
}
}, parameterObject);

DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject, boundSql);
DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject,
boundSql);

PreparedStatement ps = mock(PreparedStatement.class);

Expand All @@ -191,7 +197,8 @@ void testParameterObjectGetPropertyValueWithMetaObject() throws SQLException {
Configuration config = new Configuration();
TypeHandlerRegistry registry = config.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect", new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(config, "testSelect",
new StaticSqlSource(config, "some select statement"), SqlCommandType.SELECT).build();

Author parameterObject = new Author(-1, "cbegin", "******", "cbegin@nowhere.com", "N/A", Section.NEWS);

Expand All @@ -201,12 +208,15 @@ void testParameterObjectGetPropertyValueWithMetaObject() throws SQLException {
add(new ParameterMapping.Builder(config, "username", registry.getTypeHandler(String.class)).build());
add(new ParameterMapping.Builder(config, "password", registry.getTypeHandler(String.class)).build());
add(new ParameterMapping.Builder(config, "email", registry.getTypeHandler(String.class)).build());
add(new ParameterMapping.Builder(config, "bio", registry.getTypeHandler(String.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(config, "favouriteSection", registry.getTypeHandler(Section.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(config, "bio", registry.getTypeHandler(String.class))
.jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(config, "favouriteSection", registry.getTypeHandler(Section.class))
.jdbcType(JdbcType.VARCHAR).build());
}
}, parameterObject);

DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject, boundSql);
DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject,
boundSql);

PreparedStatement ps = mock(PreparedStatement.class);

Expand All @@ -232,24 +242,33 @@ void testParameterObjectGetPropertyValueWithMetaObjectAndCreateOnce() {

when(mockConfig.getTypeHandlerRegistry()).thenReturn(new TypeHandlerRegistry(mockConfig));
when(mockConfig.getDefaultScriptingLanguageInstance()).thenReturn(new XMLLanguageDriver());
when(mockConfig.newMetaObject(parameterObject)).thenReturn(MetaObject.forObject(parameterObject, objectFactory, objectWrapperFactory, reflectorFactory));
when(mockConfig.newMetaObject(parameterObject))
.thenReturn(MetaObject.forObject(parameterObject, objectFactory, objectWrapperFactory, reflectorFactory));

TypeHandlerRegistry registry = mockConfig.getTypeHandlerRegistry();

MappedStatement mappedStatement = new MappedStatement.Builder(mockConfig, "testSelect", new StaticSqlSource(mockConfig, "some select statement"), SqlCommandType.SELECT).build();
MappedStatement mappedStatement = new MappedStatement.Builder(mockConfig, "testSelect",
new StaticSqlSource(mockConfig, "some select statement"), SqlCommandType.SELECT).build();

BoundSql boundSql = new BoundSql(mockConfig, "some select statement", new ArrayList<ParameterMapping>() {
{
add(new ParameterMapping.Builder(mockConfig, "id", registry.getTypeHandler(int.class)).jdbcType(JdbcType.INTEGER).build());
add(new ParameterMapping.Builder(mockConfig, "username", registry.getTypeHandler(String.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "password", registry.getTypeHandler(String.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "email", registry.getTypeHandler(String.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "bio", registry.getTypeHandler(String.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "favouriteSection", registry.getTypeHandler(Section.class)).jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "id", registry.getTypeHandler(int.class))
.jdbcType(JdbcType.INTEGER).build());
add(new ParameterMapping.Builder(mockConfig, "username", registry.getTypeHandler(String.class))
.jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "password", registry.getTypeHandler(String.class))
.jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "email", registry.getTypeHandler(String.class))
.jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "bio", registry.getTypeHandler(String.class))
.jdbcType(JdbcType.VARCHAR).build());
add(new ParameterMapping.Builder(mockConfig, "favouriteSection", registry.getTypeHandler(Section.class))
.jdbcType(JdbcType.VARCHAR).build());
}
}, parameterObject);

DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject, boundSql);
DefaultParameterHandler defaultParameterHandler = new DefaultParameterHandler(mappedStatement, parameterObject,
boundSql);

PreparedStatement ps = mock(PreparedStatement.class);

Expand Down

0 comments on commit f1ba3d5

Please sign in to comment.