From 22d59b01933a34fb12eaa9be4cd28850982a3d6a Mon Sep 17 00:00:00 2001 From: panagiotiskakos Date: Mon, 9 May 2022 09:45:22 +0300 Subject: [PATCH 1/2] [JAVA-10597] Increased JOOQ version --- persistence-modules/spring-jooq/pom.xml | 2 +- .../jooq/introduction/CountQueryIntegrationTest.java | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/persistence-modules/spring-jooq/pom.xml b/persistence-modules/spring-jooq/pom.xml index c842922fe5..6a9fb0ef06 100644 --- a/persistence-modules/spring-jooq/pom.xml +++ b/persistence-modules/spring-jooq/pom.xml @@ -195,7 +195,7 @@ - 3.12.4 + 3.14.15 1.0.0 1.5 1.0.0 diff --git a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java index 7edcc2cd4b..361569554c 100644 --- a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java +++ b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java @@ -2,8 +2,6 @@ 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; @@ -68,12 +66,7 @@ public class CountQueryIntegrationTest { @Test public void givenValidData_whenFetchCountWithMultipleConditions_thenSucceed() { - Condition firstCond = AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"); - Condition secondCond = AUTHOR.ID.notEqual(1); - List conditions = new ArrayList<>(); - conditions.add(firstCond); - conditions.add(secondCond); - int count = dsl.fetchCount(AUTHOR, conditions); + int count = dsl.fetchCount(AUTHOR, AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan").and(AUTHOR.ID.notEqual(1))); Assert.assertEquals(1, count); } From 635f834aeaab755db99339042cdf0e582d011d06 Mon Sep 17 00:00:00 2001 From: panagiotiskakos Date: Tue, 10 May 2022 10:45:49 +0300 Subject: [PATCH 2/2] [JAVA-10597] Reverted + Enhanced test cases --- .../introduction/CountQueryIntegrationTest.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java index 361569554c..9765a26a2b 100644 --- a/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java +++ b/persistence-modules/spring-jooq/src/test/java/com/baeldung/jooq/introduction/CountQueryIntegrationTest.java @@ -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,10 +68,22 @@ public class CountQueryIntegrationTest { @Test public void givenValidData_whenFetchCountWithMultipleConditions_thenSucceed() { + Condition firstCond = AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan"); + Condition secondCond = AUTHOR.ID.notEqual(1); + List 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); } - + @Test public void givenValidData_whenFetchCountWithConditionsInVarargs_thenSucceed() { Condition firstCond = AUTHOR.FIRST_NAME.equalIgnoreCase("Bryan");