View Javadoc
1   /*
2    *    Copyright 2016-2025 the original author or authors.
3    *
4    *    Licensed under the Apache License, Version 2.0 (the "License");
5    *    you may not use this file except in compliance with the License.
6    *    You may obtain a copy of the License at
7    *
8    *       https://www.apache.org/licenses/LICENSE-2.0
9    *
10   *    Unless required by applicable law or agreed to in writing, software
11   *    distributed under the License is distributed on an "AS IS" BASIS,
12   *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *    See the License for the specific language governing permissions and
14   *    limitations under the License.
15   */
16  package examples.animal.data;
17  
18  import static examples.animal.data.AnimalDataDynamicSqlSupport.animalData;
19  import static examples.animal.data.AnimalDataDynamicSqlSupport.animalName;
20  import static examples.animal.data.AnimalDataDynamicSqlSupport.bodyWeight;
21  import static examples.animal.data.AnimalDataDynamicSqlSupport.brainWeight;
22  import static examples.animal.data.AnimalDataDynamicSqlSupport.id;
23  import static java.util.function.Predicate.not;
24  import static org.assertj.core.api.Assertions.assertThat;
25  import static org.junit.jupiter.api.Assertions.assertAll;
26  import static org.mybatis.dynamic.sql.SqlBuilder.*;
27  
28  import java.io.InputStream;
29  import java.io.InputStreamReader;
30  import java.sql.Connection;
31  import java.sql.DriverManager;
32  import java.util.List;
33  
34  import org.apache.ibatis.datasource.unpooled.UnpooledDataSource;
35  import org.apache.ibatis.jdbc.ScriptRunner;
36  import org.apache.ibatis.mapping.Environment;
37  import org.apache.ibatis.session.Configuration;
38  import org.apache.ibatis.session.SqlSession;
39  import org.apache.ibatis.session.SqlSessionFactory;
40  import org.apache.ibatis.session.SqlSessionFactoryBuilder;
41  import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
42  import org.jspecify.annotations.Nullable;
43  import org.junit.jupiter.api.BeforeEach;
44  import org.junit.jupiter.api.Test;
45  import org.mybatis.dynamic.sql.render.RenderingStrategies;
46  import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
47  import org.mybatis.dynamic.sql.util.Predicates;
48  
49  class OptionalConditionsWithPredicatesAnimalDataTest {
50  
51      private static final String JDBC_URL = "jdbc:hsqldb:mem:aname";
52      private static final String JDBC_DRIVER = "org.hsqldb.jdbcDriver";
53      private static final @Nullable Integer NULL_INTEGER = null;
54  
55      private SqlSessionFactory sqlSessionFactory;
56  
57      @BeforeEach
58      void setup() throws Exception {
59          Class.forName(JDBC_DRIVER);
60          InputStream is = getClass().getResourceAsStream("/examples/animal/data/CreateAnimalData.sql");
61          assert is != null;
62          try (Connection connection = DriverManager.getConnection(JDBC_URL, "sa", "")) {
63              ScriptRunner sr = new ScriptRunner(connection);
64              sr.setLogWriter(null);
65              sr.runScript(new InputStreamReader(is));
66          }
67  
68          UnpooledDataSource ds = new UnpooledDataSource(JDBC_DRIVER, JDBC_URL, "sa", "");
69          Environment environment = new Environment("test", new JdbcTransactionFactory(), ds);
70          Configuration config = new Configuration(environment);
71          config.addMapper(AnimalDataMapper.class);
72          sqlSessionFactory = new SqlSessionFactoryBuilder().build(config);
73      }
74  
75      @Test
76      void testAllIgnored() {
77          try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
78              AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
79              SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
80                      .from(animalData)
81                      .where(id, isGreaterThanWhenPresent(NULL_INTEGER))  // the where clause should not render
82                      .orderBy(id)
83                      .configureStatement(c -> c.setNonRenderingWhereClauseAllowed(true))
84                      .build()
85                      .render(RenderingStrategies.MYBATIS3);
86              List<AnimalData> animals = mapper.selectMany(selectStatement);
87              assertAll(
88                      () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData order by id"),
89                      () -> assertThat(animals).hasSize(65),
90                      () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1),
91                      () -> assertThat(animals).element(1).isNotNull().extracting(AnimalData::id).isEqualTo(2)
92              );
93          }
94      }
95  
96      @Test
97      void testIgnoredBetweenRendered() {
98          try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
99              AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
100             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
101                     .from(animalData)
102                     .where(id, isEqualTo(3))
103                     .and(id, isNotEqualToWhenPresent(NULL_INTEGER))
104                     .or(id, isEqualTo(4))
105                     .orderBy(id)
106                     .build()
107                     .render(RenderingStrategies.MYBATIS3);
108             List<AnimalData> animals = mapper.selectMany(selectStatement);
109             assertAll(
110                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id = #{parameters.p1,jdbcType=INTEGER} or id = #{parameters.p2,jdbcType=INTEGER} order by id"),
111                     () -> assertThat(animals).hasSize(2),
112                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(3),
113                     () -> assertThat(animals).element(1).isNotNull().extracting(AnimalData::id).isEqualTo(4)
114             );
115         }
116     }
117 
118     @Test
119     void testIgnoredInWhere() {
120         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
121             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
122             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
123                     .from(animalData)
124                     .where(id, isLessThanWhenPresent(NULL_INTEGER))
125                     .and(id, isEqualTo(3))
126                     .or(id, isEqualTo(4))
127                     .orderBy(id)
128                     .build()
129                     .render(RenderingStrategies.MYBATIS3);
130             List<AnimalData> animals = mapper.selectMany(selectStatement);
131             assertAll(
132                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id = #{parameters.p1,jdbcType=INTEGER} or id = #{parameters.p2,jdbcType=INTEGER} order by id"),
133                     () -> assertThat(animals).hasSize(2),
134                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(3),
135                     () -> assertThat(animals).element(1).isNotNull().extracting(AnimalData::id).isEqualTo(4)
136             );
137         }
138     }
139 
140     @Test
141     void testManyIgnored() {
142         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
143             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
144             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
145                     .from(animalData)
146                     .where(id, isLessThanWhenPresent(NULL_INTEGER), and(id, isGreaterThanOrEqualToWhenPresent(NULL_INTEGER)))
147                     .and(id, isEqualToWhenPresent(NULL_INTEGER), or(id, isEqualTo(3), and(id, isLessThanWhenPresent(NULL_INTEGER))))
148                     .or(id, isEqualToWhenPresent(4), and(id, isGreaterThanOrEqualToWhenPresent(NULL_INTEGER)))
149                     .and(id, isNotEqualToWhenPresent(NULL_INTEGER))
150                     .orderBy(id)
151                     .build()
152                     .render(RenderingStrategies.MYBATIS3);
153             List<AnimalData> animals = mapper.selectMany(selectStatement);
154             assertAll(
155                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id = #{parameters.p1,jdbcType=INTEGER} or id = #{parameters.p2,jdbcType=INTEGER} order by id"),
156                     () -> assertThat(animals).hasSize(2),
157                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(3),
158                     () -> assertThat(animals).element(1).isNotNull().extracting(AnimalData::id).isEqualTo(4)
159             );
160         }
161     }
162 
163     @Test
164     void testIgnoredInitialWhere() {
165         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
166             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
167             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
168                     .from(animalData)
169                     .where(id, isLessThanWhenPresent(NULL_INTEGER), and(id, isEqualTo(3)))
170                     .or(id, isEqualTo(4))
171                     .orderBy(id)
172                     .build()
173                     .render(RenderingStrategies.MYBATIS3);
174             List<AnimalData> animals = mapper.selectMany(selectStatement);
175             assertAll(
176                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id = #{parameters.p1,jdbcType=INTEGER} or id = #{parameters.p2,jdbcType=INTEGER} order by id"),
177                     () -> assertThat(animals).hasSize(2),
178                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(3),
179                     () -> assertThat(animals).element(1).isNotNull().extracting(AnimalData::id).isEqualTo(4)
180             );
181         }
182     }
183 
184     @Test
185     void testEqualWhenWithValue() {
186         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
187             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
188             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
189                     .from(animalData)
190                     .where(id, isEqualTo(4))
191                     .orderBy(id)
192                     .build()
193                     .render(RenderingStrategies.MYBATIS3);
194             List<AnimalData> animals = mapper.selectMany(selectStatement);
195             assertAll(
196                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id = #{parameters.p1,jdbcType=INTEGER} order by id"),
197                     () -> assertThat(animals).hasSize(1),
198                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(4)
199             );
200         }
201     }
202 
203     @Test
204     void testEqualWhenWithoutValue() {
205         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
206             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
207             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
208                     .from(animalData)
209                     .where(id, isEqualToWhenPresent(NULL_INTEGER))
210                     .and(id, isLessThanOrEqualTo(10))
211                     .orderBy(id)
212                     .build()
213                     .render(RenderingStrategies.MYBATIS3);
214             List<AnimalData> animals = mapper.selectMany(selectStatement);
215             assertAll(
216                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
217                     () -> assertThat(animals).hasSize(10),
218                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
219             );
220         }
221     }
222 
223     @Test
224     void testNotEqualWhenWithValue() {
225         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
226             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
227             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
228                     .from(animalData)
229                     .where(id, isNotEqualTo(4))
230                     .and(id, isLessThanOrEqualTo(10))
231                     .orderBy(id)
232                     .build()
233                     .render(RenderingStrategies.MYBATIS3);
234             List<AnimalData> animals = mapper.selectMany(selectStatement);
235             assertAll(
236                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <> #{parameters.p1,jdbcType=INTEGER} and id <= #{parameters.p2,jdbcType=INTEGER} order by id"),
237                     () -> assertThat(animals).hasSize(9),
238                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
239             );
240         }
241     }
242 
243     @Test
244     void testNotEqualWhenWithoutValue() {
245         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
246             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
247             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
248                     .from(animalData)
249                     .where(id, isNotEqualToWhenPresent(NULL_INTEGER))
250                     .and(id, isLessThanOrEqualTo(10))
251                     .orderBy(id)
252                     .build()
253                     .render(RenderingStrategies.MYBATIS3);
254             List<AnimalData> animals = mapper.selectMany(selectStatement);
255             assertAll(
256                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
257                     () -> assertThat(animals).hasSize(10),
258                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
259             );
260         }
261     }
262 
263     @Test
264     void testGreaterThanWhenWithValue() {
265         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
266             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
267             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
268                     .from(animalData)
269                     .where(id, isGreaterThan(4))
270                     .and(id, isLessThanOrEqualTo(10))
271                     .orderBy(id)
272                     .build()
273                     .render(RenderingStrategies.MYBATIS3);
274             List<AnimalData> animals = mapper.selectMany(selectStatement);
275             assertAll(
276                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id > #{parameters.p1,jdbcType=INTEGER} and id <= #{parameters.p2,jdbcType=INTEGER} order by id"),
277                     () -> assertThat(animals).hasSize(6),
278                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(5)
279             );
280         }
281     }
282 
283     @Test
284     void testGreaterThanWhenWithoutValue() {
285         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
286             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
287             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
288                     .from(animalData)
289                     .where(id, isGreaterThanWhenPresent(NULL_INTEGER))
290                     .and(id, isLessThanOrEqualTo(10))
291                     .orderBy(id)
292                     .build()
293                     .render(RenderingStrategies.MYBATIS3);
294             List<AnimalData> animals = mapper.selectMany(selectStatement);
295             assertAll(
296                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
297                     () -> assertThat(animals).hasSize(10),
298                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
299             );
300         }
301     }
302 
303     @Test
304     void testGreaterThanOrEqualToWhenWithValue() {
305         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
306             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
307             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
308                     .from(animalData)
309                     .where(id, isGreaterThanOrEqualTo(4))
310                     .and(id, isLessThanOrEqualTo(10))
311                     .orderBy(id)
312                     .build()
313                     .render(RenderingStrategies.MYBATIS3);
314             List<AnimalData> animals = mapper.selectMany(selectStatement);
315             assertAll(
316                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id >= #{parameters.p1,jdbcType=INTEGER} and id <= #{parameters.p2,jdbcType=INTEGER} order by id"),
317                     () -> assertThat(animals).hasSize(7),
318                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(4)
319             );
320         }
321     }
322 
323     @Test
324     void testGreaterThanOrEqualToWhenWithoutValue() {
325         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
326             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
327             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
328                     .from(animalData)
329                     .where(id, isGreaterThanOrEqualToWhenPresent(NULL_INTEGER))
330                     .and(id, isLessThanOrEqualTo(10))
331                     .orderBy(id)
332                     .build()
333                     .render(RenderingStrategies.MYBATIS3);
334             List<AnimalData> animals = mapper.selectMany(selectStatement);
335             assertAll(
336                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
337                     () -> assertThat(animals).hasSize(10),
338                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
339             );
340         }
341     }
342 
343     @Test
344     void testLessThanWhenWithValue() {
345         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
346             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
347             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
348                     .from(animalData)
349                     .where(id, isLessThan(4))
350                     .orderBy(id)
351                     .build()
352                     .render(RenderingStrategies.MYBATIS3);
353             List<AnimalData> animals = mapper.selectMany(selectStatement);
354             assertAll(
355                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id < #{parameters.p1,jdbcType=INTEGER} order by id"),
356                     () -> assertThat(animals).hasSize(3),
357                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
358             );
359         }
360     }
361 
362     @Test
363     void testLessThanWhenWithoutValue() {
364         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
365             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
366             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
367                     .from(animalData)
368                     .where(id, isLessThanWhenPresent(NULL_INTEGER))
369                     .and(id, isLessThanOrEqualTo(10))
370                     .orderBy(id)
371                     .build()
372                     .render(RenderingStrategies.MYBATIS3);
373             List<AnimalData> animals = mapper.selectMany(selectStatement);
374             assertAll(
375                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
376                     () -> assertThat(animals).hasSize(10),
377                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
378             );
379         }
380     }
381 
382     @Test
383     void testLessThanOrEqualToWhenWithValue() {
384         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
385             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
386             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
387                     .from(animalData)
388                     .where(id, isLessThanOrEqualTo(4))
389                     .orderBy(id)
390                     .build()
391                     .render(RenderingStrategies.MYBATIS3);
392             List<AnimalData> animals = mapper.selectMany(selectStatement);
393             assertAll(
394                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
395                     () -> assertThat(animals).hasSize(4),
396                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
397             );
398         }
399     }
400 
401     @Test
402     void testLessThanOrEqualToWhenWithoutValue() {
403         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
404             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
405             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
406                     .from(animalData)
407                     .where(id, isLessThanOrEqualToWhenPresent(NULL_INTEGER))
408                     .and(id, isLessThanOrEqualTo(10))
409                     .orderBy(id)
410                     .build()
411                     .render(RenderingStrategies.MYBATIS3);
412             List<AnimalData> animals = mapper.selectMany(selectStatement);
413             assertAll(
414                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
415                     () -> assertThat(animals).hasSize(10),
416                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
417             );
418         }
419     }
420 
421     @Test
422     void testIsInWhenWithValue() {
423         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
424             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
425             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
426                     .from(animalData)
427                     .where(id, isIn(4, 5, 6))
428                     .orderBy(id)
429                     .build()
430                     .render(RenderingStrategies.MYBATIS3);
431             List<AnimalData> animals = mapper.selectMany(selectStatement);
432             assertAll(
433                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id in (#{parameters.p1,jdbcType=INTEGER},#{parameters.p2,jdbcType=INTEGER},#{parameters.p3,jdbcType=INTEGER}) order by id"),
434                     () -> assertThat(animals).hasSize(3),
435                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(4)
436             );
437         }
438     }
439 
440     @Test
441     void testIsInWhenWithSomeValues() {
442         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
443             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
444             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
445                     .from(animalData)
446                     .where(id, isInWhenPresent(3, NULL_INTEGER, 5).map(i -> i + 3))
447                     .orderBy(id)
448                     .build()
449                     .render(RenderingStrategies.MYBATIS3);
450             List<AnimalData> animals = mapper.selectMany(selectStatement);
451             assertAll(
452                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id in (#{parameters.p1,jdbcType=INTEGER},#{parameters.p2,jdbcType=INTEGER}) order by id"),
453                     () -> assertThat(animals).hasSize(2),
454                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(6),
455                     () -> assertThat(animals).element(1).isNotNull().extracting(AnimalData::id).isEqualTo(8)
456             );
457         }
458     }
459 
460     @Test
461     void testIsInCaseInsensitiveWhenWithValue() {
462         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
463             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
464             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
465                     .from(animalData)
466                     .where(animalName, isInCaseInsensitive("mouse", "musk shrew"))
467                     .orderBy(id)
468                     .build()
469                     .render(RenderingStrategies.MYBATIS3);
470             List<AnimalData> animals = mapper.selectMany(selectStatement);
471             assertAll(
472                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where upper(animal_name) in (#{parameters.p1,jdbcType=VARCHAR},#{parameters.p2,jdbcType=VARCHAR}) order by id"),
473                     () -> assertThat(animals).hasSize(2),
474                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(4)
475             );
476         }
477     }
478 
479     @Test
480     void testValueStreamTransformer() {
481         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
482             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
483             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
484                     .from(animalData)
485                     .where(animalName, isInWhenPresent("  Mouse", "  ", null, "", "Musk shrew  ")
486                                     .map(String::trim)
487                                     .filter(not(String::isEmpty)))
488                     .orderBy(id)
489                     .build()
490                     .render(RenderingStrategies.MYBATIS3);
491             List<AnimalData> animals = mapper.selectMany(selectStatement);
492             assertAll(
493                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where animal_name in (#{parameters.p1,jdbcType=VARCHAR},#{parameters.p2,jdbcType=VARCHAR}) order by id"),
494                     () -> assertThat(animals).hasSize(2),
495                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(4)
496             );
497         }
498     }
499 
500     @Test
501     void testValueStreamTransformerWithCustomCondition() {
502         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
503             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
504             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
505                     .from(animalData)
506                     .where(animalName, MyInCondition.isIn("  Mouse", "  ", null, "", "Musk shrew  "))
507                     .orderBy(id)
508                     .build()
509                     .render(RenderingStrategies.MYBATIS3);
510             List<AnimalData> animals = mapper.selectMany(selectStatement);
511             assertAll(
512                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where animal_name in (#{parameters.p1,jdbcType=VARCHAR},#{parameters.p2,jdbcType=VARCHAR}) order by id"),
513                     () -> assertThat(animals).hasSize(2),
514                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(4)
515             );
516         }
517     }
518 
519     @Test
520     void testIsInCaseInsensitiveWhenWithNoValues() {
521         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
522             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
523             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
524                     .from(animalData)
525                     .where(animalName, isInCaseInsensitiveWhenPresent())
526                     .and(id, isLessThanOrEqualTo(10))
527                     .orderBy(id)
528                     .build()
529                     .render(RenderingStrategies.MYBATIS3);
530             List<AnimalData> animals = mapper.selectMany(selectStatement);
531             assertAll(
532                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
533                     () -> assertThat(animals).hasSize(10),
534                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
535             );
536         }
537     }
538 
539     @Test
540     void testIsNotInWhenWithValue() {
541         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
542             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
543             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
544                     .from(animalData)
545                     .where(id, isNotIn(4, 5, 6))
546                     .and(id, isLessThanOrEqualTo(10))
547                     .orderBy(id)
548                     .build()
549                     .render(RenderingStrategies.MYBATIS3);
550             List<AnimalData> animals = mapper.selectMany(selectStatement);
551             assertAll(
552                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id not in (#{parameters.p1,jdbcType=INTEGER},#{parameters.p2,jdbcType=INTEGER},#{parameters.p3,jdbcType=INTEGER}) and id <= #{parameters.p4,jdbcType=INTEGER} order by id"),
553                     () -> assertThat(animals).hasSize(7),
554                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
555             );
556         }
557     }
558 
559     @Test
560     void testIsNotInWhenWithSomeValues() {
561         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
562             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
563             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
564                     .from(animalData)
565                     .where(id, isNotInWhenPresent(3, NULL_INTEGER, 5))
566                     .and(id, isLessThanOrEqualTo(10))
567                     .orderBy(id)
568                     .build()
569                     .render(RenderingStrategies.MYBATIS3);
570             List<AnimalData> animals = mapper.selectMany(selectStatement);
571             assertAll(
572                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id not in (#{parameters.p1,jdbcType=INTEGER},#{parameters.p2,jdbcType=INTEGER}) and id <= #{parameters.p3,jdbcType=INTEGER} order by id"),
573                     () -> assertThat(animals).hasSize(8),
574                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
575             );
576         }
577     }
578 
579     @Test
580     void testIsNotInCaseInsensitiveWhenWithValue() {
581         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
582             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
583             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
584                     .from(animalData)
585                     .where(animalName, isNotInCaseInsensitive("mouse", "musk shrew"))
586                     .and(id, isLessThanOrEqualTo(10))
587                     .orderBy(id)
588                     .build()
589                     .render(RenderingStrategies.MYBATIS3);
590             List<AnimalData> animals = mapper.selectMany(selectStatement);
591             assertAll(
592                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where upper(animal_name) not in (#{parameters.p1,jdbcType=VARCHAR},#{parameters.p2,jdbcType=VARCHAR}) and id <= #{parameters.p3,jdbcType=INTEGER} order by id"),
593                     () -> assertThat(animals).hasSize(8),
594                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
595             );
596         }
597     }
598 
599     @Test
600     void testIsNotInCaseInsensitiveWhenWithNoValues() {
601         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
602             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
603             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
604                     .from(animalData)
605                     .where(animalName, isNotInCaseInsensitiveWhenPresent())
606                     .and(id, isLessThanOrEqualTo(10))
607                     .orderBy(id)
608                     .build()
609                     .render(RenderingStrategies.MYBATIS3);
610             List<AnimalData> animals = mapper.selectMany(selectStatement);
611             assertAll(
612                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
613                     () -> assertThat(animals).hasSize(10),
614                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
615             );
616         }
617     }
618 
619     @Test
620     void testIsBetweenWhenWithValues() {
621         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
622             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
623             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
624                     .from(animalData)
625                     .where(id, isBetween(3).and(6).filter(Predicates.bothPresent()))
626                     .orderBy(id)
627                     .build()
628                     .render(RenderingStrategies.MYBATIS3);
629             List<AnimalData> animals = mapper.selectMany(selectStatement);
630             assertAll(
631                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id between #{parameters.p1,jdbcType=INTEGER} and #{parameters.p2,jdbcType=INTEGER} order by id"),
632                     () -> assertThat(animals).hasSize(4),
633                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(3)
634             );
635         }
636     }
637 
638     @Test
639     void testIsBetweenWhenWithFirstMissing() {
640         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
641             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
642             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
643                     .from(animalData)
644                     .where(id, isBetweenWhenPresent(NULL_INTEGER).and(6))
645                     .and(id, isLessThanOrEqualTo(10))
646                     .orderBy(id)
647                     .build()
648                     .render(RenderingStrategies.MYBATIS3);
649             List<AnimalData> animals = mapper.selectMany(selectStatement);
650             assertAll(
651                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
652                     () -> assertThat(animals).hasSize(10),
653                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
654             );
655         }
656     }
657 
658     @Test
659     void testIsBetweenWhenWithSecondMissing() {
660         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
661             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
662             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
663                     .from(animalData)
664                     .where(id, isBetweenWhenPresent(3).and(NULL_INTEGER))
665                     .and(id, isLessThanOrEqualTo(10))
666                     .orderBy(id)
667                     .build()
668                     .render(RenderingStrategies.MYBATIS3);
669             List<AnimalData> animals = mapper.selectMany(selectStatement);
670             assertAll(
671                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
672                     () -> assertThat(animals).hasSize(10),
673                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
674             );
675         }
676     }
677 
678     @Test
679     void testIsBetweenWhenWithBothMissing() {
680         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
681             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
682             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
683                     .from(animalData)
684                     .where(id, isBetweenWhenPresent(NULL_INTEGER).and(NULL_INTEGER))
685                     .and(id, isLessThanOrEqualTo(10))
686                     .orderBy(id)
687                     .build()
688                     .render(RenderingStrategies.MYBATIS3);
689             List<AnimalData> animals = mapper.selectMany(selectStatement);
690             assertAll(
691                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
692                     () -> assertThat(animals).hasSize(10),
693                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
694             );
695         }
696     }
697 
698     @Test
699     void testIsNotBetweenWhenWithValues() {
700         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
701             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
702             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
703                     .from(animalData)
704                     .where(id, isNotBetween(3).and(6).filter(Predicates.bothPresent()))
705                     .and(id, isLessThanOrEqualTo(10))
706                     .orderBy(id)
707                     .build()
708                     .render(RenderingStrategies.MYBATIS3);
709             List<AnimalData> animals = mapper.selectMany(selectStatement);
710             assertAll(
711                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id not between #{parameters.p1,jdbcType=INTEGER} and #{parameters.p2,jdbcType=INTEGER} and id <= #{parameters.p3,jdbcType=INTEGER} order by id"),
712                     () -> assertThat(animals).hasSize(6),
713                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
714             );
715         }
716     }
717 
718     @Test
719     void testIsNotBetweenWhenWithFirstMissing() {
720         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
721             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
722             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
723                     .from(animalData)
724                     .where(id, isNotBetweenWhenPresent(NULL_INTEGER).and(6))
725                     .and(id, isLessThanOrEqualTo(10))
726                     .orderBy(id)
727                     .build()
728                     .render(RenderingStrategies.MYBATIS3);
729             List<AnimalData> animals = mapper.selectMany(selectStatement);
730             assertAll(
731                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
732                     () -> assertThat(animals).hasSize(10),
733                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
734             );
735         }
736     }
737 
738     @Test
739     void testIsNotBetweenWhenWithSecondMissing() {
740         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
741             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
742             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
743                     .from(animalData)
744                     .where(id, isNotBetweenWhenPresent(3).and(NULL_INTEGER))
745                     .and(id, isLessThanOrEqualTo(10))
746                     .orderBy(id)
747                     .build()
748                     .render(RenderingStrategies.MYBATIS3);
749             List<AnimalData> animals = mapper.selectMany(selectStatement);
750             assertAll(
751                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
752                     () -> assertThat(animals).hasSize(10),
753                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
754             );
755         }
756     }
757 
758     @Test
759     void testIsNotBetweenWhenWithBothMissing() {
760         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
761             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
762             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
763                     .from(animalData)
764                     .where(id, isNotBetweenWhenPresent(NULL_INTEGER).and(NULL_INTEGER))
765                     .and(id, isLessThanOrEqualTo(10))
766                     .orderBy(id)
767                     .build()
768                     .render(RenderingStrategies.MYBATIS3);
769             List<AnimalData> animals = mapper.selectMany(selectStatement);
770             assertAll(
771                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
772                     () -> assertThat(animals).hasSize(10),
773                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
774             );
775         }
776     }
777 
778     @Test
779     void testIsLikeWhenWithValue() {
780         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
781             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
782             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
783                     .from(animalData)
784                     .where(animalName, isLike("%mole"))
785                     .and(id, isLessThanOrEqualTo(10))
786                     .orderBy(id)
787                     .build()
788                     .render(RenderingStrategies.MYBATIS3);
789             List<AnimalData> animals = mapper.selectMany(selectStatement);
790             assertAll(
791                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where animal_name like #{parameters.p1,jdbcType=VARCHAR} and id <= #{parameters.p2,jdbcType=INTEGER} order by id"),
792                     () -> assertThat(animals).hasSize(2),
793                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(6)
794             );
795         }
796     }
797 
798     @Test
799     void testIsLikeWhenWithoutValue() {
800         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
801             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
802             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
803                     .from(animalData)
804                     .where(animalName, isLikeWhenPresent((String) null))
805                     .and(id, isLessThanOrEqualTo(10))
806                     .orderBy(id)
807                     .build()
808                     .render(RenderingStrategies.MYBATIS3);
809             List<AnimalData> animals = mapper.selectMany(selectStatement);
810             assertAll(
811                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
812                     () -> assertThat(animals).hasSize(10),
813                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
814             );
815         }
816     }
817 
818     @Test
819     void testIsLikeCaseInsensitiveWhenWithValue() {
820         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
821             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
822             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
823                     .from(animalData)
824                     .where(animalName, isLikeCaseInsensitive("%MoLe"))
825                     .and(id, isLessThanOrEqualTo(10))
826                     .orderBy(id)
827                     .build()
828                     .render(RenderingStrategies.MYBATIS3);
829             List<AnimalData> animals = mapper.selectMany(selectStatement);
830             assertAll(
831                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where upper(animal_name) like #{parameters.p1,jdbcType=VARCHAR} and id <= #{parameters.p2,jdbcType=INTEGER} order by id"),
832                     () -> assertThat(animals).hasSize(2),
833                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(6)
834             );
835         }
836     }
837 
838     @Test
839     void testIsLikeCaseInsensitiveWhenWithoutValue() {
840         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
841             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
842             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
843                     .from(animalData)
844                     .where(animalName, isLikeCaseInsensitiveWhenPresent((String) null))
845                     .and(id, isLessThanOrEqualTo(10))
846                     .orderBy(id)
847                     .build()
848                     .render(RenderingStrategies.MYBATIS3);
849             List<AnimalData> animals = mapper.selectMany(selectStatement);
850             assertAll(
851                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
852                     () -> assertThat(animals).hasSize(10),
853                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
854             );
855         }
856     }
857 
858     @Test
859     void testIsNotLikeWhenWithValue() {
860         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
861             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
862             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
863                     .from(animalData)
864                     .where(animalName, isNotLike("%mole"))
865                     .and(id, isLessThanOrEqualTo(10))
866                     .orderBy(id)
867                     .build()
868                     .render(RenderingStrategies.MYBATIS3);
869             List<AnimalData> animals = mapper.selectMany(selectStatement);
870             assertAll(
871                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where animal_name not like #{parameters.p1,jdbcType=VARCHAR} and id <= #{parameters.p2,jdbcType=INTEGER} order by id"),
872                     () -> assertThat(animals).hasSize(8),
873                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
874             );
875         }
876     }
877 
878     @Test
879     void testIsNotLikeWhenWithoutValue() {
880         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
881             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
882             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
883                     .from(animalData)
884                     .where(animalName, isNotLikeWhenPresent((String) null))
885                     .and(id, isLessThanOrEqualTo(10))
886                     .orderBy(id)
887                     .build()
888                     .render(RenderingStrategies.MYBATIS3);
889             List<AnimalData> animals = mapper.selectMany(selectStatement);
890             assertAll(
891                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
892                     () -> assertThat(animals).hasSize(10),
893                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
894             );
895         }
896     }
897 
898     @Test
899     void testIsNotLikeCaseInsensitiveWhenWithValue() {
900         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
901             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
902             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
903                     .from(animalData)
904                     .where(animalName, isNotLikeCaseInsensitive("%MoLe"))
905                     .and(id, isLessThanOrEqualTo(10))
906                     .orderBy(id)
907                     .build()
908                     .render(RenderingStrategies.MYBATIS3);
909             List<AnimalData> animals = mapper.selectMany(selectStatement);
910             assertAll(
911                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where upper(animal_name) not like #{parameters.p1,jdbcType=VARCHAR} and id <= #{parameters.p2,jdbcType=INTEGER} order by id"),
912                     () -> assertThat(animals).hasSize(8),
913                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
914             );
915         }
916     }
917 
918     @Test
919     void testIsNotLikeCaseInsensitiveWhenWithoutValue() {
920         try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
921             AnimalDataMapper mapper = sqlSession.getMapper(AnimalDataMapper.class);
922             SelectStatementProvider selectStatement = select(id, animalName, bodyWeight, brainWeight)
923                     .from(animalData)
924                     .where(animalName, isNotLikeCaseInsensitiveWhenPresent((String) null))
925                     .and(id, isLessThanOrEqualTo(10))
926                     .orderBy(id)
927                     .build()
928                     .render(RenderingStrategies.MYBATIS3);
929             List<AnimalData> animals = mapper.selectMany(selectStatement);
930             assertAll(
931                     () -> assertThat(selectStatement.getSelectStatement()).isEqualTo("select id, animal_name, body_weight, brain_weight from AnimalData where id <= #{parameters.p1,jdbcType=INTEGER} order by id"),
932                     () -> assertThat(animals).hasSize(10),
933                     () -> assertThat(animals).first().isNotNull().extracting(AnimalData::id).isEqualTo(1)
934             );
935         }
936     }
937 }