From aa91a4b7784bfb3f169b472a1599dcb32b9c0f0e Mon Sep 17 00:00:00 2001 From: Jonathan Maniquet Date: Sat, 7 Feb 2026 10:02:52 +0100 Subject: [PATCH 1/3] Prepare next development iteration to 3.0.2-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d2856749..855ae6c3 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ assertj-db - 3.0.1 + 3.0.2-SNAPSHOT AssertJ-DB - Assertions for database AssertJ-DB - Rich and fluent assertions for testing with database From dafdd3ccbc5e0270072d75606794c74b83f99361 Mon Sep 17 00:00:00 2001 From: Jonathan Maniquet Date: Sat, 7 Feb 2026 11:03:18 +0100 Subject: [PATCH 2/3] Makes Core and DB assertions coexist with only one import --- src/main/java/org/assertj/db/type/Changes.java | 17 ++++++++++++++++- src/main/java/org/assertj/db/type/Request.java | 17 ++++++++++++++++- src/main/java/org/assertj/db/type/Table.java | 17 ++++++++++++++++- .../db/type/Changes_Constructor_Test.java | 13 ++++++++++++- 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/assertj/db/type/Changes.java b/src/main/java/org/assertj/db/type/Changes.java index c79eddf1..d279e3dc 100644 --- a/src/main/java/org/assertj/db/type/Changes.java +++ b/src/main/java/org/assertj/db/type/Changes.java @@ -24,6 +24,9 @@ import java.util.List; import java.util.function.Consumer; +import org.assertj.core.api.AssertProvider; +import org.assertj.db.api.Assertions; +import org.assertj.db.api.ChangesAssert; import org.assertj.db.exception.AssertJDBException; import org.assertj.db.util.ChangeComparator; @@ -85,7 +88,7 @@ * @author Régis Pouiller * @author Julien Roy */ -public class Changes extends AbstractDbElement { +public class Changes extends AbstractDbElement implements AssertProvider { /** * The list of the tables. @@ -679,4 +682,16 @@ public Changes build() { return new Changes(this.connectionProvider); } } + + /** + * Makes both AssertJ Core and AssertJ DB assertions able to coexist in the same class with {@link org.assertj.core.api.Assertions org.assertj.core.api.Assertions.assertThat} as the only import necessary.

+ * Also works for both BDDAssertions.then static methods from AssertJ Core and AssertJ DB.

+ * + * @see org.assertj.core.api.Assertions#assertThat(AssertProvider) <T> org.assertj.core.api.Assertions.assertThat(AssertProvider<T> component) + * @see org.assertj.core.api.BDDAssertions#then(AssertProvider) <T> org.assertj.core.api.BDDAssertions.then(AssertProvider<T> component) + */ + @Override + public ChangesAssert assertThat() { + return Assertions.assertThat(this); + } } diff --git a/src/main/java/org/assertj/db/type/Request.java b/src/main/java/org/assertj/db/type/Request.java index 5fade7a8..32e4ec60 100644 --- a/src/main/java/org/assertj/db/type/Request.java +++ b/src/main/java/org/assertj/db/type/Request.java @@ -21,6 +21,9 @@ import java.util.Arrays; import java.util.List; +import org.assertj.core.api.AssertProvider; +import org.assertj.db.api.Assertions; +import org.assertj.db.api.RequestAssert; import org.assertj.db.type.lettercase.LetterCase; /** @@ -62,7 +65,7 @@ * @author Régis Pouiller * @author Julien Roy */ -public class Request extends AbstractDbData { +public class Request extends AbstractDbData implements AssertProvider { /** * SQL request to get the values. @@ -226,4 +229,16 @@ public Request build() { return new Request(this.connectionProvider, this.request, this.parameters, this.pksName); } } + + /** + * Makes both AssertJ Core and AssertJ DB assertions able to coexist in the same class with {@link org.assertj.core.api.Assertions org.assertj.core.api.Assertions.assertThat} as the only import necessary.

+ * Also works for both BDDAssertions.then static methods from AssertJ Core and AssertJ DB.

+ * + * @see org.assertj.core.api.Assertions#assertThat(AssertProvider) <T> org.assertj.core.api.Assertions.assertThat(AssertProvider<T> component) + * @see org.assertj.core.api.BDDAssertions#then(AssertProvider) <T> org.assertj.core.api.BDDAssertions.then(AssertProvider<T> component) + */ + @Override + public RequestAssert assertThat() { + return Assertions.assertThat(this); + } } diff --git a/src/main/java/org/assertj/db/type/Table.java b/src/main/java/org/assertj/db/type/Table.java index 44ac1d40..ccbf3dd3 100644 --- a/src/main/java/org/assertj/db/type/Table.java +++ b/src/main/java/org/assertj/db/type/Table.java @@ -22,6 +22,9 @@ import java.util.Arrays; import java.util.List; +import org.assertj.core.api.AssertProvider; +import org.assertj.db.api.Assertions; +import org.assertj.db.api.TableAssert; import org.assertj.db.exception.AssertJDBException; import org.assertj.db.type.lettercase.LetterCase; import org.assertj.db.util.NameComparator; @@ -73,7 +76,7 @@ * @author Régis Pouiller * @author Julien Roy */ -public class Table extends AbstractDbData { +public class Table extends AbstractDbData
implements AssertProvider { /** * The name of the table. @@ -726,4 +729,16 @@ public enum OrderType { DESC } } + + /** + * Makes both AssertJ Core and AssertJ DB assertions able to coexist in the same class with {@link org.assertj.core.api.Assertions org.assertj.core.api.Assertions.assertThat} as the only import necessary.

+ * Also works for both BDDAssertions.then static methods from AssertJ Core and AssertJ DB.

+ * + * @see org.assertj.core.api.Assertions#assertThat(AssertProvider) <T> org.assertj.core.api.Assertions.assertThat(AssertProvider<T> component) + * @see org.assertj.core.api.BDDAssertions#then(AssertProvider) <T> org.assertj.core.api.BDDAssertions.then(AssertProvider<T> component) + */ + @Override + public TableAssert assertThat() { + return Assertions.assertThat(this); + } } diff --git a/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java b/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java index 633754a1..e670b2bc 100644 --- a/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java +++ b/src/test/java/org/assertj/db/type/Changes_Constructor_Test.java @@ -12,8 +12,11 @@ */ package org.assertj.db.type; -import static org.assertj.core.api.Assertions.assertThat; +import java.util.List; +import org.assertj.core.api.Assertions; +import org.assertj.core.api.ListAssert; +import org.assertj.core.api.ObjectAssert; import org.assertj.db.common.AbstractTest; import org.junit.Test; @@ -193,4 +196,12 @@ public void test_constructor_request() { assertThat(changes.getTablesAtStartPointList()).isNull(); assertThat(changes.getTablesAtEndPointList()).isNull(); } + + private static ObjectAssert assertThat(Object o) { + return Assertions.assertThat(o); + } + + private static ListAssert assertThat(List list) { + return Assertions.assertThat(list); + } } From 271ac9091f67b4d3fae3aae1a735c859190035f9 Mon Sep 17 00:00:00 2001 From: Jonathan Maniquet Date: Sat, 14 Feb 2026 18:00:50 +0100 Subject: [PATCH 3/3] Adds tests for the methods integrating with AssertJ Core --- .../db/type/Changes_AssertThat_Test.java | 40 +++++++++++++++++++ .../db/type/Request_AssertThat_Test.java | 40 +++++++++++++++++++ .../db/type/Table_AssertThat_Test.java | 40 +++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 src/test/java/org/assertj/db/type/Changes_AssertThat_Test.java create mode 100644 src/test/java/org/assertj/db/type/Request_AssertThat_Test.java create mode 100644 src/test/java/org/assertj/db/type/Table_AssertThat_Test.java diff --git a/src/test/java/org/assertj/db/type/Changes_AssertThat_Test.java b/src/test/java/org/assertj/db/type/Changes_AssertThat_Test.java new file mode 100644 index 00000000..ea79c167 --- /dev/null +++ b/src/test/java/org/assertj/db/type/Changes_AssertThat_Test.java @@ -0,0 +1,40 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2025 the original author or authors. + */ +package org.assertj.db.type; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.assertj.db.api.ChangesAssert; +import org.assertj.db.common.AbstractTest; +import org.junit.Test; + +/** + * These tests are on the return from the {@code assertThat} method of {@code Changes}. + *

+ * + * @author Jonathan Maniquet + */ +public class Changes_AssertThat_Test extends AbstractTest { + + /** + * This method tests the result of {@code assertThat} method from {@code Changes}. + */ + @Test + public void test_result_of_assertThat() { + Changes changes = assertDbConnection.changes().request("SELECT actor.name FROM actor").build(); + + ChangesAssert assertObject = changes.assertThat(); + assertThat(assertObject).isNotNull() + .extracting("changes").isSameAs(changes); + } +} diff --git a/src/test/java/org/assertj/db/type/Request_AssertThat_Test.java b/src/test/java/org/assertj/db/type/Request_AssertThat_Test.java new file mode 100644 index 00000000..80bdaf36 --- /dev/null +++ b/src/test/java/org/assertj/db/type/Request_AssertThat_Test.java @@ -0,0 +1,40 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2025 the original author or authors. + */ +package org.assertj.db.type; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.assertj.db.api.RequestAssert; +import org.assertj.db.common.AbstractTest; +import org.junit.Test; + +/** + * These tests are on the return from the {@code assertThat} method of {@code Request}. + *

+ * + * @author Jonathan Maniquet + */ +public class Request_AssertThat_Test extends AbstractTest { + + /** + * This method tests the result of {@code assertThat} method from {@code Request}. + */ + @Test + public void test_result_of_assertThat() { + Request request = assertDbConnection.request("SELECT actor.name FROM actor").build(); + + RequestAssert assertObject = request.assertThat(); + assertThat(assertObject).isNotNull() + .extracting("actual").isSameAs(request); + } +} diff --git a/src/test/java/org/assertj/db/type/Table_AssertThat_Test.java b/src/test/java/org/assertj/db/type/Table_AssertThat_Test.java new file mode 100644 index 00000000..ad6ea442 --- /dev/null +++ b/src/test/java/org/assertj/db/type/Table_AssertThat_Test.java @@ -0,0 +1,40 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * + * Copyright 2015-2025 the original author or authors. + */ +package org.assertj.db.type; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.assertj.db.api.TableAssert; +import org.assertj.db.common.AbstractTest; +import org.junit.Test; + +/** + * These tests are on the return from the {@code assertThat} method of {@code Table}. + *

+ * + * @author Jonathan Maniquet + */ +public class Table_AssertThat_Test extends AbstractTest { + + /** + * This method tests the result of {@code assertThat} method from {@code Table}. + */ + @Test + public void test_result_of_assertThat() { + Table table = assertDbConnection.table("actor").build(); + + TableAssert assertObject = table.assertThat(); + assertThat(assertObject).isNotNull() + .extracting("actual").isSameAs(table); + } +}