Skip to content

Commit 0848d7c

Browse files
committed
Random cleanup
1 parent e1ea69d commit 0848d7c

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

Diff for: src/test/java/issues/gh105/Issue105Test.java

+4-9
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ void testFuzzyLikeBothPresent() {
4949

5050
@Test
5151
void testFuzzyLikeFirstNameNull() {
52-
String fName = null;
5352
String lName = "Flintstone";
5453

5554
SelectStatementProvider selectStatement = select(id, firstName, lastName)
5655
.from(person)
57-
.where(firstName, isLikeWhenPresent(fName).map(SearchUtils::addWildcards))
56+
.where(firstName, isLikeWhenPresent((String) null).map(SearchUtils::addWildcards))
5857
.and(lastName, isLike(lName).map(SearchUtils::addWildcards))
5958
.build()
6059
.render(RenderingStrategies.MYBATIS3);
@@ -70,12 +69,11 @@ void testFuzzyLikeFirstNameNull() {
7069
@Test
7170
void testFuzzyLikeLastNameNull() {
7271
String fName = "Fred";
73-
String lName = null;
7472

7573
SelectStatementProvider selectStatement = select(id, firstName, lastName)
7674
.from(person)
7775
.where(firstName, isLike(fName).map(SearchUtils::addWildcards))
78-
.and(lastName, isLikeWhenPresent(lName).map(SearchUtils::addWildcards))
76+
.and(lastName, isLikeWhenPresent((String) null).map(SearchUtils::addWildcards))
7977
.build()
8078
.render(RenderingStrategies.MYBATIS3);
8179

@@ -89,13 +87,10 @@ void testFuzzyLikeLastNameNull() {
8987

9088
@Test
9189
void testFuzzyLikeBothNull() {
92-
String fName = null;
93-
String lName = null;
94-
9590
SelectStatementProvider selectStatement = select(id, firstName, lastName)
9691
.from(person)
97-
.where(firstName, isLikeWhenPresent(fName).map(SearchUtils::addWildcards))
98-
.and(lastName, isLikeWhenPresent(lName).map(SearchUtils::addWildcards))
92+
.where(firstName, isLikeWhenPresent((String) null).map(SearchUtils::addWildcards))
93+
.and(lastName, isLikeWhenPresent((String) null).map(SearchUtils::addWildcards))
9994
.configureStatement(c -> c.setNonRenderingWhereClauseAllowed(true))
10095
.build()
10196
.render(RenderingStrategies.MYBATIS3);

Diff for: src/test/java/org/mybatis/dynamic/sql/insert/GeneralInsertStatementTest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ void testInsertStatementBuilderWithConstants() {
8585

8686
@Test
8787
void testSelectiveInsertStatementBuilder() {
88-
Integer myId = null;
89-
String myFirstName = null;
9088
String myLastName = "jones";
9189
String myOccupation = "dino driver";
9290

9391
GeneralInsertStatementProvider insertStatement = insertInto(foo)
94-
.set(id).toValueWhenPresent(() -> myId)
95-
.set(firstName).toValueWhenPresent(myFirstName)
92+
.set(id).toValueWhenPresent(() -> null)
93+
.set(firstName).toValueWhenPresent((String) null)
9694
.set(lastName).toValueWhenPresent(() -> myLastName)
9795
.set(occupation).toValueWhenPresent(myOccupation)
9896
.build()

0 commit comments

Comments
 (0)