zonkyio / embedded-postgres

Java embedded PostgreSQL component for testing
Apache License 2.0
344 stars 43 forks source link

Class org.junit.rules.ExternalResource not found - continuing with a stub. #38

Closed tymm closed 4 years ago

tymm commented 4 years ago

When trying to use Flyway migration with embedded-postgres, I get the following error:

Class org.junit.rules.ExternalResource not found - continuing with a stub.
[error]           EmbeddedPostgresRules.preparedDatabase(
[error]           ^

What am I doing wrong?

tomix26 commented 4 years ago

Are you using junit4? EmbeddedPostgresRules is intended for use in junit4 tests. If you are using junit5, you need to use EmbeddedPostgresExtension instead. Other testing frameworks are not supported at this moment. Check the following issue for more information about junit5 support: https://github.com/zonkyio/embedded-postgres/issues/34

tymm commented 4 years ago

Thanks. No, I'm not using junit at all. But turns out that I can just use getPostgresDatabase to get the DataSource and with that use Flyway as normal for migration.