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

migrate to JUnit 5 #649

Merged
merged 3 commits into from
Aug 28, 2021
Merged

migrate to JUnit 5 #649

merged 3 commits into from
Aug 28, 2021

Conversation

gotson
Copy link
Collaborator

@gotson gotson commented Aug 27, 2021

Migrating all tests to JUnit 5 using the Jupiter engine.

This also removes the need to declare test classes in AllTests.java, which for instance was overlooked on my collation PR (#627), thus tests were not running when running mvn test.

@Test(expected = SQLException.class)
public void reproduceDatabaseLocked() throws SQLException
{
@Disabled("Not sure this worked recently, the second query cannot find the table 'sample'")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that i had to disable this test.

In JUnit 4 the way to assert that an exception is thrown is to use expected in the @Test declaration, but that doesn't ensure the exception was thrown at the right place.

For this test ResultSet rs = stat2.executeQuery("select count(*) from sample"); throws an exception because the table sample cannot be found.

I think the test passed in JUnit 4, but for the wrong reason.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok. Thanks

@gotson
Copy link
Collaborator Author

gotson commented Aug 27, 2021

@xerial this is a requirement to automate GraalVM native tests

@xerial
Copy link
Owner

xerial commented Aug 28, 2021

Thanks for cleaning up tests. It seems we need to introduce some code formatter :)

@xerial xerial merged commit d0fbee0 into xerial:master Aug 28, 2021
@gotson gotson deleted the junit5 branch August 29, 2021 00:04
@gotson
Copy link
Collaborator Author

gotson commented Aug 29, 2021

Thanks for cleaning up tests. It seems we need to introduce some code formatter :)

Yes indeed that would help, and maybe some enforcers or quality check. Any tool you had experience with that you would like better than another?

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

Successfully merging this pull request may close these issues.

2 participants