Package io.github.zero88.jooqx
Interface SQLTestHelper
public interface SQLTestHelper
-
Method Summary
Modifier and TypeMethodDescriptiondefault <X> void
assertJooqException
(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<X> ar, org.jooq.exception.SQLStateClass stateClass) Assert async result is completed with error then compare exceptiondefault <X> void
assertJooqException
(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<X> ar, org.jooq.exception.SQLStateClass stateClass, String errorMsg) Assert async result is completed with error then compare exceptiondefault <X> void
assertJooqException
(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<X> ar, org.jooq.exception.SQLStateClass stateClass, String errorMsg, Class<? extends Throwable> causeType) Assert async result is completed with error then compare exceptiondefault void
assertJooqException
(org.jooq.exception.SQLStateClass stateClass, boolean failed, Throwable cause) Internal compare.default <R> List<R>
assertResultSize
(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<List<R>> asyncResult, int expected) Assert async result is completed successful then compare result sizedefault <T> T
assertSuccess
(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<T> asyncResult) Assert async result is completed successfulstatic String
getCurrentDBVersion
(String defaultVersion) Get current database version by system property "dbVersion
"default void
prepareDatabase
(io.vertx.junit5.VertxTestContext context, JooqSQL<?> jooqSql, SQLConnectionOption connOption, String... files) Prepare database schema and test data by plain JDBC connection.
-
Method Details
-
getCurrentDBVersion
Get current database version by system property "dbVersion
"- Returns:
- the current database version
-
prepareDatabase
default void prepareDatabase(io.vertx.junit5.VertxTestContext context, JooqSQL<?> jooqSql, SQLConnectionOption connOption, String... files) Prepare database schema and test data by plain JDBC connection. That useHikariCP
- Parameters:
context
- test contextjooqSql
- jooqSQLconnOption
- database connection optionfiles
- resource SQL files
-
assertSuccess
default <T> T assertSuccess(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<T> asyncResult) Assert async result is completed successful- Type Parameters:
T
- type of output- Parameters:
context
- test contextasyncResult
- async result- Returns:
- output
-
assertResultSize
default <R> List<R> assertResultSize(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<List<R>> asyncResult, int expected) Assert async result is completed successful then compare result size- Type Parameters:
R
- type of output- Parameters:
context
- test contextasyncResult
- async resultexpected
- expected size- Returns:
- list of output
-
assertJooqException
default <X> void assertJooqException(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<X> ar, org.jooq.exception.SQLStateClass stateClass) Assert async result is completed with error then compare exception- Type Parameters:
X
- type of result- Parameters:
context
- test contextar
- async resultstateClass
- An expectation SQL state class- See Also:
-
SQLStateClass
-
assertJooqException
default <X> void assertJooqException(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<X> ar, org.jooq.exception.SQLStateClass stateClass, String errorMsg) Assert async result is completed with error then compare exception- Type Parameters:
X
- type of result- Parameters:
context
- test contextar
- async resultstateClass
- An expectation SQL state classerrorMsg
- An expectation error message
-
assertJooqException
default <X> void assertJooqException(io.vertx.junit5.VertxTestContext context, io.vertx.core.AsyncResult<X> ar, org.jooq.exception.SQLStateClass stateClass, String errorMsg, Class<? extends Throwable> causeType) Assert async result is completed with error then compare exception- Type Parameters:
X
- type of result- Parameters:
context
- test contextar
- async resultstateClass
- An expectation SQL state classerrorMsg
- An expectation error messagecauseType
- An expectation cause type
-
assertJooqException
default void assertJooqException(org.jooq.exception.SQLStateClass stateClass, boolean failed, Throwable cause) Internal compare. Don't use it directly
-