Skip to content

Commit 0a9a366

Browse files
committed
Test updates for SonarQube
1 parent 187c53f commit 0a9a366

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/test/java/examples/animal/data/AnimalDataTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1753,9 +1753,9 @@ void testGeneralInsert() {
17531753
+ "values (#{parameters.p1,jdbcType=INTEGER}, 'Fred', 2.2, #{parameters.p2,jdbcType=DOUBLE})";
17541754

17551755
assertThat(insertStatement.getInsertStatement()).isEqualTo(expected);
1756-
assertThat(insertStatement.getParameters().size()).isEqualTo(2);
1757-
assertThat(insertStatement.getParameters().get("p1")).isEqualTo(101);
1758-
assertThat(insertStatement.getParameters().get("p2")).isEqualTo(4.5);
1756+
assertThat(insertStatement.getParameters()).hasSize(2);
1757+
assertThat(insertStatement.getParameters()).containsEntry("p1", 101);
1758+
assertThat(insertStatement.getParameters()).containsEntry("p2", 4.5);
17591759

17601760
int rows = mapper.generalInsert(insertStatement);
17611761
assertThat(rows).isEqualTo(1);

src/test/java/org/mybatis/dynamic/sql/insert/GeneralInsertStatementTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.mybatis.dynamic.sql.insert.render.GeneralInsertStatementProvider;
2727
import org.mybatis.dynamic.sql.render.RenderingStrategies;
2828

29-
public class GeneralInsertStatementTest {
29+
class GeneralInsertStatementTest {
3030

3131
private static final SqlTable foo = SqlTable.of("foo");
3232
private static final SqlColumn<Integer> id = foo.column("id", JDBCType.INTEGER);
@@ -35,7 +35,7 @@ public class GeneralInsertStatementTest {
3535
private static final SqlColumn<String> occupation = foo.column("occupation", JDBCType.VARCHAR);
3636

3737
@Test
38-
public void testFullInsertStatementBuilder() {
38+
void testFullInsertStatementBuilder() {
3939

4040
GeneralInsertStatementProvider insertStatement = insertInto(foo)
4141
.set(id).equalTo(2)
@@ -52,7 +52,7 @@ public void testFullInsertStatementBuilder() {
5252
}
5353

5454
@Test
55-
public void testInsertStatementBuilderWithNulls() {
55+
void testInsertStatementBuilderWithNulls() {
5656

5757
GeneralInsertStatementProvider insertStatement = insertInto(foo)
5858
.set(id).equalTo(1)
@@ -68,7 +68,7 @@ public void testInsertStatementBuilderWithNulls() {
6868
}
6969

7070
@Test
71-
public void testInsertStatementBuilderWithConstants() {
71+
void testInsertStatementBuilderWithConstants() {
7272

7373
GeneralInsertStatementProvider insertStatement = insertInto(foo)
7474
.set(id).equalToConstant("3")
@@ -84,7 +84,7 @@ public void testInsertStatementBuilderWithConstants() {
8484
}
8585

8686
@Test
87-
public void testSelectiveInsertStatementBuilder() {
87+
void testSelectiveInsertStatementBuilder() {
8888
Integer myId = null;
8989
String myFirstName = null;
9090
String myLastName = "jones";

src/test/java/org/mybatis/dynamic/sql/insert/InsertStatementTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void testParallelStreamWithParameters() {
176176
assertAll(
177177
() -> assertThat(collector.columnsPhrase()).isEqualTo(expectedColumnsPhrase),
178178
() -> assertThat(collector.valuesPhrase()).isEqualTo(expectedValuesPhrase),
179-
() -> assertThat(collector.parameters().size()).isEqualTo(4)
179+
() -> assertThat(collector.parameters()).hasSize(4)
180180
);
181181
}
182182

src/test/java/org/mybatis/dynamic/sql/util/ColumnMappingVisitorTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2016-2019 the original author or authors.
2+
* Copyright 2016-2020 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.
@@ -22,10 +22,10 @@
2222
import org.mybatis.dynamic.sql.SqlColumn;
2323
import org.mybatis.dynamic.sql.SqlTable;
2424

25-
public class ColumnMappingVisitorTest {
25+
class ColumnMappingVisitorTest {
2626

2727
@Test
28-
public void testThatUnimplementedMethod1ThrowExceptions() {
28+
void testThatUnimplementedMethod1ThrowExceptions() {
2929
TestTable table = new TestTable();
3030
TestVisitor tv = new TestVisitor();
3131
ColumnToColumnMapping mapping = ColumnToColumnMapping.of(table.id, table.description);
@@ -34,7 +34,7 @@ public void testThatUnimplementedMethod1ThrowExceptions() {
3434
}
3535

3636
@Test
37-
public void testThatUnimplementedMethod2ThrowExceptions() {
37+
void testThatUnimplementedMethod2ThrowExceptions() {
3838
TestTable table = new TestTable();
3939
TestVisitor tv = new TestVisitor();
4040
ValueMapping<Integer> mapping = ValueMapping.of(table.id, () -> 3);
@@ -43,7 +43,7 @@ public void testThatUnimplementedMethod2ThrowExceptions() {
4343
}
4444

4545
@Test
46-
public void testThatUnimplementedMethod3ThrowExceptions() {
46+
void testThatUnimplementedMethod3ThrowExceptions() {
4747
TestTable table = new TestTable();
4848
TestVisitor tv = new TestVisitor();
4949
SelectMapping mapping = SelectMapping.of(table.id, SqlBuilder.select(table.id).from(table));
@@ -52,7 +52,7 @@ public void testThatUnimplementedMethod3ThrowExceptions() {
5252
}
5353

5454
@Test
55-
public void testThatUnimplementedMethod4ThrowExceptions() {
55+
void testThatUnimplementedMethod4ThrowExceptions() {
5656
TestTable table = new TestTable();
5757
TestVisitor tv = new TestVisitor();
5858
PropertyMapping mapping = PropertyMapping.of(table.id, "id");

0 commit comments

Comments
 (0)