[JAVA-10597] Reverted + Enhanced test cases
This commit is contained in:
parent
22d59b0193
commit
635f834aea
|
@ -2,6 +2,8 @@ package com.baeldung.jooq.introduction;
|
||||||
|
|
||||||
import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR;
|
import static com.baeldung.jooq.introduction.db.public_.tables.Author.AUTHOR;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.jooq.Condition;
|
import org.jooq.Condition;
|
||||||
import org.jooq.DSLContext;
|
import org.jooq.DSLContext;
|
||||||
|
@ -66,6 +68,18 @@ public class CountQueryIntegrationTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenValidData_whenFetchCountWithMultipleConditions_thenSucceed() {
|
public void givenValidData_whenFetchCountWithMultipleConditions_thenSucceed() {
|
||||||
|
Condition firstCond = AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan");
|
||||||
|
Condition secondCond = AUTHOR.ID.notEqual(1);
|
||||||
|
List<Condition> conditions = new ArrayList<>();
|
||||||
|
conditions.add(firstCond);
|
||||||
|
conditions.add(secondCond);
|
||||||
|
int count = dsl.fetchCount(AUTHOR, conditions);
|
||||||
|
Assert.assertEquals(1, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenValidData_whenFetchCountWithMultipleConditionsUsingAndOperator_thenSucceed() {
|
||||||
int count = dsl.fetchCount(AUTHOR, AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan").and(AUTHOR.ID.notEqual(1)));
|
int count = dsl.fetchCount(AUTHOR, AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan").and(AUTHOR.ID.notEqual(1)));
|
||||||
Assert.assertEquals(1, count);
|
Assert.assertEquals(1, count);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue