Skip to content

Commit 0c27e97

Browse files
committed
Make the Tests Pass
1 parent b47aed4 commit 0c27e97

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ void testInConditionWithEventuallyEmptyList() {
672672

673673
SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
674674
.from(animalData)
675-
.where(id, isIn(null, 22, null).filter(Objects::nonNull).filter(i -> i != 22))
675+
.where(id, isInWhenPresent(null, 22, null).filter(i -> i != 22))
676676
.configureStatement(c -> c.setNonRenderingWhereClauseAllowed(true))
677677
.build()
678678
.render(RenderingStrategies.MYBATIS3);
@@ -694,6 +694,7 @@ void testInConditionWithEventuallyEmptyListForceRendering() {
694694
SelectModel selectModel = select(id, animalName, bodyWeight, brainWeight)
695695
.from(animalData)
696696
.where(id, isIn(inValues).filter(Objects::nonNull).filter(i -> i != 22))
697+
.configureStatement(c -> c.setEmptyListConditionRenderingAllowed(false))
697698
.build();
698699

699700
assertThatExceptionOfType(NonRenderingWhereClauseException.class).isThrownBy(() ->
@@ -706,6 +707,7 @@ void testInConditionWithEmptyList() {
706707
SelectModel selectModel = select(id, animalName, bodyWeight, brainWeight)
707708
.from(animalData)
708709
.where(id, isIn(Collections.emptyList()))
710+
.configureStatement(c -> c.setEmptyListConditionRenderingAllowed(false))
709711
.build();
710712

711713
assertThatExceptionOfType(NonRenderingWhereClauseException.class).isThrownBy(() ->
@@ -784,7 +786,7 @@ void testNotInConditionWithEventuallyEmptyList() {
784786

785787
SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
786788
.from(animalData)
787-
.where(id, isNotIn(null, 22, null).filter(Objects::nonNull).filter(i -> i != 22))
789+
.where(id, isNotInWhenPresent(null, 22, null).filter(i -> i != 22))
788790
.configureStatement(c -> c.setNonRenderingWhereClauseAllowed(true))
789791
.build()
790792
.render(RenderingStrategies.MYBATIS3);
@@ -802,6 +804,7 @@ void testNotInConditionWithEventuallyEmptyListForceRendering() {
802804
.from(animalData)
803805
.where(id, isNotIn(null, 22, null)
804806
.filter(Objects::nonNull).filter(i -> i != 22))
807+
.configureStatement(c -> c.setEmptyListConditionRenderingAllowed(false))
805808
.build();
806809

807810
assertThatExceptionOfType(NonRenderingWhereClauseException.class).isThrownBy(() ->

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ void testIsInCaseInsensitiveWhenWithNoValues() {
522522
AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
523523
SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
524524
.from(animalData)
525-
.where(animalName, isInCaseInsensitive())
525+
.where(animalName, isInCaseInsensitiveWhenPresent())
526526
.and(id, isLessThanOrEqualTo(10))
527527
.orderBy(id)
528528
.build()
@@ -602,7 +602,7 @@ void testIsNotInCaseInsensitiveWhenWithNoValues() {
602602
AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
603603
SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
604604
.from(animalData)
605-
.where(animalName, isNotInCaseInsensitive())
605+
.where(animalName, isNotInCaseInsensitiveWhenPresent())
606606
.and(id, isLessThanOrEqualTo(10))
607607
.orderBy(id)
608608
.build()

src/test/java/org/mybatis/dynamic/sql/select/SelectStatementTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ void testInEmptyList() {
291291
SelectModel selectModel = select(column1, column3)
292292
.from(table, "a")
293293
.where(column3, isIn(emptyList))
294+
.configureStatement(c -> c.setEmptyListConditionRenderingAllowed(false))
294295
.build();
295296

296297
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
@@ -304,6 +305,7 @@ void testNotInEmptyList() {
304305
SelectModel selectModel = select(column1, column3)
305306
.from(table, "a")
306307
.where(column3, isNotIn(emptyList))
308+
.configureStatement(c -> c.setEmptyListConditionRenderingAllowed(false))
307309
.build();
308310

309311
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
@@ -329,6 +331,7 @@ void testInCaseInsensitiveEmptyList() {
329331
SelectModel selectModel = select(column1, column3)
330332
.from(table, "a")
331333
.where(column3, isInCaseInsensitive(Collections.emptyList()))
334+
.configureStatement(c -> c.setEmptyListConditionRenderingAllowed(false))
332335
.build();
333336

334337
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
@@ -366,6 +369,7 @@ void testNotInCaseInsensitiveEmptyList() {
366369
SelectModel selectModel = select(column1, column3)
367370
.from(table, "a")
368371
.where(column3, isNotInCaseInsensitive(Collections.emptyList()))
372+
.configureStatement(c -> c.setEmptyListConditionRenderingAllowed(false))
369373
.build();
370374

371375
assertThatExceptionOfType(NonRenderingWhereClauseException.class).isThrownBy(() ->

0 commit comments

Comments
 (0)