[JAVA-10597] Reverted + Enhanced test cases

This commit is contained in:
panagiotiskakos 2022-05-10 10:45:49 +03:00
parent 22d59b0193
commit 635f834aea
1 changed files with 15 additions and 1 deletions

View File

@ -2,6 +2,8 @@ package com.baeldung.jooq.introduction;
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.DSLContext;
@ -66,6 +68,18 @@ public class CountQueryIntegrationTest {
@Test
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)));
Assert.assertEquals(1, count);
}