Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question regarding Junit 5 #34

Open
sfali opened this issue Jun 21, 2020 · 2 comments
Open

Question regarding Junit 5 #34

sfali opened this issue Jun 21, 2020 · 2 comments

Comments

@sfali
Copy link

sfali commented Jun 21, 2020

Hi There,

Do you have any example how to use embedded-postgres with Junit5 and use custom database instead of default postgres database?

Regards,

Syed Ali

@tomix26
Copy link
Collaborator

tomix26 commented Jun 26, 2020

Hi, I think the usage should be the same as in the case of junit4, so it should look something like this:

@RegisterExtension
public SingleInstancePostgresExtension pg = EmbeddedPostgresExtension.singleInstance();

Or this:

@RegisterExtension
public PreparedDbExtension pg = EmbeddedPostgresExtension.preparedDatabase(FlywayPreparer.forClasspathLocation("db/my-db-schema"));

The first extension uses postgres database, the second extension creates independent databases with randomly generated names. In both cases, the database name cannot be changed by the user.

@sfali
Copy link
Author

sfali commented Jul 3, 2020

Thanks for reply, I would try this.

Regards,

Syed Ali

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants