Package org.jdbi.v3.testing.junit5
Class JdbiPostgresExtension
java.lang.Object
org.jdbi.v3.testing.junit5.JdbiExtension
org.jdbi.v3.testing.junit5.JdbiPostgresExtension
- All Implemented Interfaces:
 org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.ParameterResolver
Jdbi PostgreSQL JUnit 5 rule using the pg-embedded component.
 
 Using this class with the @ExtendWith annotation is equivalent to using the SingleDatabaseBuilder to create a EmbeddedPgExtension
 that creates a new postgres instance per test. This is slower than using the MultiDatabaseBuilder and using
 JdbiExtension.postgres(EmbeddedPgExtension).
 
Override methods for special case construction:
     @RegisterExtension
     public JdbiExtension extension = new JdbiPostgresExtension(pg) {
         @Override
         protected DataSource createDataSource() {
            ...
         }
     };
 
 
 Use with ExtendWith:
 
 @ExtendWith(JdbiPostgresExtension.class)
 public class DatabaseTest {
     @Test
     public void testWithJdbi(Jdbi jdbi) {
         ...
     }
     @Test
     public void testWithHandle(Handle handle) {
         ...
     }
 }
 - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidafterEach(org.junit.jupiter.api.extension.ExtensionContext context) voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context) getUrl()Returns a JDBC url representing the data source used by this extension.Methods inherited from class org.jdbi.v3.testing.junit5.JdbiExtension
attach, externalPostgres, getJdbi, getSharedHandle, h2, installPlugins, openHandle, otjEmbeddedPostgres, postgres, resolveParameter, sqlite, supportsParameter, withConfig, withInitializer, withPlugin, withPlugins 
- 
Constructor Details
- 
JdbiPostgresExtension
public JdbiPostgresExtension() 
 - 
 - 
Method Details
- 
getUrl
Description copied from class:JdbiExtensionReturns a JDBC url representing the data source used by this extension. This url is database-specific and may or may not be used to connect to the data source outside testing code that uses this extension (e.g. theJdbiSqliteExtensionreturns a constant uri for all database instances).- Specified by:
 getUrlin classJdbiExtension- Returns:
 - A string representing the JDBC URL.
 
 - 
beforeEach
- Specified by:
 beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback- Overrides:
 beforeEachin classJdbiExtension- Throws:
 Exception
 - 
afterEach
- Specified by:
 afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback- Overrides:
 afterEachin classJdbiExtension- Throws:
 Exception
 
 -