Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>

<artifactId>assertj-db</artifactId>
<version>3.0.1</version>
<version>3.0.2-SNAPSHOT</version>

<name>AssertJ-DB - Assertions for database</name>
<description>AssertJ-DB - Rich and fluent assertions for testing with database</description>
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/org/assertj/db/type/Changes.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -85,7 +88,7 @@
* @author Régis Pouiller
* @author Julien Roy
*/
public class Changes extends AbstractDbElement<Changes> {
public class Changes extends AbstractDbElement<Changes> implements AssertProvider<ChangesAssert> {

/**
* The list of the tables.
Expand Down Expand Up @@ -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.<br/><br/>
* Also works for both <code>BDDAssertions.then</code> static methods from AssertJ Core and AssertJ DB.<br/><br/>
*
* @see org.assertj.core.api.Assertions#assertThat(AssertProvider) &lt;T&gt; org.assertj.core.api.Assertions.assertThat(AssertProvider&lt;T&gt; component)
* @see org.assertj.core.api.BDDAssertions#then(AssertProvider) &lt;T&gt; org.assertj.core.api.BDDAssertions.then(AssertProvider&lt;T&gt; component)
*/
@Override
public ChangesAssert assertThat() {
return Assertions.assertThat(this);
}
}
17 changes: 16 additions & 1 deletion src/main/java/org/assertj/db/type/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import java.util.Arrays;
import java.util.List;

import org.assertj.core.api.AssertProvider;
import org.assertj.core.api.Assertions;
import org.assertj.db.api.RequestAssert;
import org.assertj.db.type.lettercase.LetterCase;

/**
Expand Down Expand Up @@ -62,7 +65,7 @@
* @author Régis Pouiller
* @author Julien Roy
*/
public class Request extends AbstractDbData<Request> {
public class Request extends AbstractDbData<Request> implements AssertProvider<RequestAssert> {

/**
* SQL request to get the values.
Expand Down Expand Up @@ -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.<br/><br/>
* Also works for both <code>BDDAssertions.then</code> static methods from AssertJ Core and AssertJ DB.<br/><br/>
*
* @see org.assertj.core.api.Assertions#assertThat(AssertProvider) &lt;T&gt; org.assertj.core.api.Assertions.assertThat(AssertProvider&lt;T&gt; component)
* @see org.assertj.core.api.BDDAssertions#then(AssertProvider) &lt;T&gt; org.assertj.core.api.BDDAssertions.then(AssertProvider&lt;T&gt; component)
*/
@Override
public RequestAssert assertThat() {
return Assertions.assertThat(this);
}
}
17 changes: 16 additions & 1 deletion src/main/java/org/assertj/db/type/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,7 +76,7 @@
* @author Régis Pouiller
* @author Julien Roy
*/
public class Table extends AbstractDbData<Table> {
public class Table extends AbstractDbData<Table> implements AssertProvider<TableAssert> {

/**
* The name of the table.
Expand Down Expand Up @@ -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.<br/><br/>
* Also works for both <code>BDDAssertions.then</code> static methods from AssertJ Core and AssertJ DB.<br/><br/>
*
* @see org.assertj.core.api.Assertions#assertThat(AssertProvider) &lt;T&gt; org.assertj.core.api.Assertions.assertThat(AssertProvider&lt;T&gt; component)
* @see org.assertj.core.api.BDDAssertions#then(AssertProvider) &lt;T&gt; org.assertj.core.api.BDDAssertions.then(AssertProvider&lt;T&gt; component)
*/
@Override
public TableAssert assertThat() {
return Assertions.assertThat(this);
}
}
13 changes: 12 additions & 1 deletion src/test/java/org/assertj/db/type/Changes_Constructor_Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -193,4 +196,12 @@ public void test_constructor_request() {
assertThat(changes.getTablesAtStartPointList()).isNull();
assertThat(changes.getTablesAtEndPointList()).isNull();
}

private static ObjectAssert<Object> assertThat(Object o) {
return Assertions.assertThat(o);
}

private static <T> ListAssert<Object> assertThat(List<T> list) {
return Assertions.assertThat(list);
}
}