Class DatabaseTestUtil
- java.lang.Object
-
- org.curioswitch.common.testing.database.DatabaseTestUtil
-
public final class DatabaseTestUtil extends java.lang.Object
Utilities for working with a mock database in tests.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DatabaseTestUtil.MockDataProviderStubber
static class
DatabaseTestUtil.MockDataProviderVerifier
-
Field Summary
Fields Modifier and Type Field Description static org.jooq.DSLContext
DB
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.jooq.tools.jdbc.MockDataProvider
mockProvider()
static org.jooq.DSLContext
newDbContext(org.jooq.tools.jdbc.MockDataProvider dataProvider)
Returns aDSLContext
with a mock connection using the providedMockDataProvider
.static DatabaseTestUtil.MockDataProviderVerifier
verifyQueried(CurioMockDataProvider provider, java.lang.String query)
static DatabaseTestUtil.MockDataProviderVerifier
verifyQueried(CurioMockDataProvider provider, java.lang.String query, org.mockito.verification.VerificationMode mode)
static DatabaseTestUtil.MockDataProviderStubber
whenQueried(CurioMockDataProvider provider, java.lang.String query)
Setup aDatabaseTestUtil.MockDataProviderStubber
which can be used to set an expectation to return records or throw an exception when thequery
is executed on theprovider
.
-
-
-
Method Detail
-
mockProvider
public static org.jooq.tools.jdbc.MockDataProvider mockProvider()
-
newDbContext
public static org.jooq.DSLContext newDbContext(org.jooq.tools.jdbc.MockDataProvider dataProvider)
Returns aDSLContext
with a mock connection using the providedMockDataProvider
.
-
whenQueried
public static DatabaseTestUtil.MockDataProviderStubber whenQueried(CurioMockDataProvider provider, java.lang.String query)
Setup aDatabaseTestUtil.MockDataProviderStubber
which can be used to set an expectation to return records or throw an exception when thequery
is executed on theprovider
.
-
verifyQueried
public static DatabaseTestUtil.MockDataProviderVerifier verifyQueried(CurioMockDataProvider provider, java.lang.String query)
-
verifyQueried
public static DatabaseTestUtil.MockDataProviderVerifier verifyQueried(CurioMockDataProvider provider, java.lang.String query, org.mockito.verification.VerificationMode mode)
-
-