|
35 | 35 | import java.util.Objects;
|
36 | 36 |
|
37 | 37 | import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
|
38 |
| -import org.apache.ibatis.exceptions.PersistenceException; |
39 | 38 | import org.apache.ibatis.jdbc.ScriptRunner;
|
40 | 39 | import org.apache.ibatis.mapping.Environment;
|
41 | 40 | import org.apache.ibatis.session.Configuration;
|
|
56 | 55 | import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
57 | 56 | import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
58 | 57 | import org.mybatis.dynamic.sql.render.TableAliasCalculator;
|
| 58 | +import org.mybatis.dynamic.sql.select.SelectModel; |
59 | 59 | import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
60 | 60 | import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
61 | 61 | import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
@@ -598,23 +598,25 @@ void testInConditionWithEventuallyEmptyListForceRendering() {
|
598 | 598 | inValues.add(22);
|
599 | 599 | inValues.add(null);
|
600 | 600 |
|
601 |
| - assertThatExceptionOfType(RuntimeException.class).describedAs("Fred").isThrownBy(() -> |
602 |
| - select(id, animalName, bodyWeight, brainWeight) |
| 601 | + SelectModel selectModel = select(id, animalName, bodyWeight, brainWeight) |
603 | 602 | .from(animalData)
|
604 | 603 | .where(id, isInRequired(inValues).then(s -> s.filter(Objects::nonNull).filter(i -> i != 22)))
|
605 |
| - .build() |
606 |
| - .render(RenderingStrategies.MYBATIS3) |
| 604 | + .build(); |
| 605 | + |
| 606 | + assertThatExceptionOfType(RuntimeException.class).describedAs("Fred").isThrownBy(() -> |
| 607 | + selectModel.render(RenderingStrategies.MYBATIS3) |
607 | 608 | );
|
608 | 609 | }
|
609 | 610 |
|
610 | 611 | @Test
|
611 | 612 | void testInConditionWithEmptyList() {
|
| 613 | + SelectModel selectModel = select(id, animalName, bodyWeight, brainWeight) |
| 614 | + .from(animalData) |
| 615 | + .where(id, isInRequired(Collections.emptyList())) |
| 616 | + .build(); |
| 617 | + |
612 | 618 | assertThatExceptionOfType(RuntimeException.class).describedAs("Fred").isThrownBy(() ->
|
613 |
| - select(id, animalName, bodyWeight, brainWeight) |
614 |
| - .from(animalData) |
615 |
| - .where(id, isInRequired(Collections.emptyList())) |
616 |
| - .build() |
617 |
| - .render(RenderingStrategies.MYBATIS3) |
| 619 | + selectModel.render(RenderingStrategies.MYBATIS3) |
618 | 620 | );
|
619 | 621 | }
|
620 | 622 |
|
@@ -706,13 +708,15 @@ void testNotInConditionWithEventuallyEmptyList() {
|
706 | 708 |
|
707 | 709 | @Test
|
708 | 710 | void testNotInConditionWithEventuallyEmptyListForceRendering() {
|
709 |
| - assertThatExceptionOfType(RuntimeException.class).describedAs("Fred").isThrownBy(() -> |
710 |
| - select(id, animalName, bodyWeight, brainWeight) |
| 711 | + SelectModel selectModel = select(id, animalName, bodyWeight, brainWeight) |
711 | 712 | .from(animalData)
|
712 | 713 | .where(id, isNotInRequired(null, 22, null)
|
713 | 714 | .then(s -> s.filter(Objects::nonNull).filter(i -> i != 22)))
|
714 |
| - .build() |
715 |
| - .render(RenderingStrategies.MYBATIS3)); |
| 715 | + .build(); |
| 716 | + |
| 717 | + assertThatExceptionOfType(RuntimeException.class).describedAs("Fred").isThrownBy(() -> |
| 718 | + selectModel.render(RenderingStrategies.MYBATIS3) |
| 719 | + ); |
716 | 720 | }
|
717 | 721 |
|
718 | 722 | @SafeVarargs
|
|
0 commit comments