Skip to content

Commit d6ed781

Browse files
committed
Remove some duplicate tests
1 parent 785ea41 commit d6ed781

File tree

2 files changed

+10
-39
lines changed

2 files changed

+10
-39
lines changed

src/test/java/examples/spring/PersonTemplateTest.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -525,33 +525,6 @@ void testUpdate() {
525525
});
526526
}
527527

528-
@Test
529-
void testUpdateOneField() {
530-
Buildable<GeneralInsertModel> insertStatement = insertInto(person)
531-
.set(id).toValue(100)
532-
.set(firstName).toValue("Joe")
533-
.set(lastName).toValue(LastName.of("Jones"))
534-
.set(birthDate).toValue(new Date())
535-
.set(employed).toValue(true)
536-
.set(occupation).toValue("Developer")
537-
.set(addressId).toValue(1);
538-
539-
int rows = template.generalInsert(insertStatement);
540-
assertThat(rows).isEqualTo(1);
541-
542-
Buildable<UpdateModel> updateStatement = update(person)
543-
.set(occupation).equalTo("Programmer")
544-
.where(id, isEqualTo(100));
545-
rows = template.update(updateStatement);
546-
assertThat(rows).isEqualTo(1);
547-
548-
Buildable<SelectModel> selectStatement = select(id, firstName, lastName, birthDate, employed, occupation, addressId)
549-
.from(person)
550-
.where(id, isEqualTo(100));
551-
Optional<PersonRecord> newRecord = template.selectOne(selectStatement, personRowMapper);
552-
assertThat(newRecord).hasValueSatisfying(r -> assertThat(r.getOccupation()).isEqualTo("Programmer"));
553-
}
554-
555528
@Test
556529
void testUpdateAll() {
557530
Buildable<GeneralInsertModel> insertStatement = insertInto(person)

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,13 @@ void testGroupBySingleColumn() {
288288
@Test
289289
void testInEmptyList() {
290290
List<String> emptyList = Collections.emptyList();
291-
SelectModel selectModel = select(column1, column3)
291+
SelectStatementProvider selectStatement = select(column1, column3)
292292
.from(table, "a")
293-
.where(column3, isInWhenPresent(emptyList))
294-
.build();
293+
.where(column3, isIn(emptyList))
294+
.build()
295+
.render(RenderingStrategies.MYBATIS3);
295296

296-
assertThatExceptionOfType(RuntimeException.class).isThrownBy(() ->
297-
selectModel.render(RenderingStrategies.MYBATIS3)
298-
);
297+
assertThat(selectStatement.getSelectStatement()).isEqualTo("select a.column1, a.column3 from foo a where a.column3 in ()");
299298
}
300299

301300
@Test
@@ -363,14 +362,13 @@ void testNotInWhenPresentEmptyList() {
363362

364363
@Test
365364
void testNotInCaseInsensitiveEmptyList() {
366-
SelectModel selectModel = select(column1, column3)
365+
SelectStatementProvider selectStatement = select(column1, column3)
367366
.from(table, "a")
368-
.where(column3, isNotInCaseInsensitiveWhenPresent(Collections.emptyList()))
369-
.build();
367+
.where(column3, isNotInCaseInsensitive(Collections.emptyList()))
368+
.build()
369+
.render(RenderingStrategies.MYBATIS3);
370370

371-
assertThatExceptionOfType(NonRenderingWhereClauseException.class).isThrownBy(() ->
372-
selectModel.render(RenderingStrategies.MYBATIS3)
373-
);
371+
assertThat(selectStatement.getSelectStatement()).isEqualTo("select a.column1, a.column3 from foo a where upper(a.column3) not in ()");
374372
}
375373

376374
@Test

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy