Skip to content

Commit

Permalink
Improve existing test for filterMany using raw with separate SQL quer…
Browse files Browse the repository at this point in the history
…y for filterMany
  • Loading branch information
rbygrave committed Aug 19, 2023
1 parent c07d5e2 commit 9756c91
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,22 @@ public void filterMany_firstMaxRows_expressionFluidStyle() {
}

@Test
public void test_with_findOne() {

public void test_with_findOne_rawSeparateQuery() {
ResetBasicData.reset();

LoggedSql.start();
Customer customer = DB.find(Customer.class)
.setMaxRows(1)
.order().asc("id")
.fetch("orders")
.filterMany("orders").raw("1 = 0")
.filterMany("orders").raw("orderDate is not null")
.findOne();

assertThat(customer).isNotNull();
List<String> sql = LoggedSql.stop();
assertThat(sql).hasSize(2);
assertThat(sql.get(0)).contains("from o_customer t0 order by");
assertThat(sql.get(1)).contains("from o_order t0 join o_customer t1 on t1.id = t0.kcustomer_id where");
}

@Test
Expand Down

0 comments on commit 9756c91

Please sign in to comment.