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

Add checker for JUnit @Test annotation in overridden tests #14027

Closed
Tracked by #9378
ebyhr opened this issue Sep 7, 2022 · 4 comments
Closed
Tracked by #9378

Add checker for JUnit @Test annotation in overridden tests #14027

ebyhr opened this issue Sep 7, 2022 · 4 comments
Labels

Comments

@ebyhr
Copy link
Member

ebyhr commented Sep 7, 2022

TestNG runs overridden tests regardless of @Test annotation, but JUnit silently ignores such tests. It would be nice to have a checker to enforce the annotation since there're many overridden tests in Trino especially for BaseConnectorTest and BaseConnectorSmokeTest.

public abstract class BaseTest
{
    @Test
    public void test()
    {
        assertEquals(1, 1);
    }
}

public class TestBaseTest
        extends BaseTest
{
    // TestNG runs this test, but JUnit doesn't
    @Override
    public void test()
    {
        assertEquals(1, 2);
    }
}

Tested in #14025
Relates to #9378 and junit-team/junit5#960

@ebyhr
Copy link
Member Author

ebyhr commented May 22, 2023

cc: @wendigo

@ebyhr
Copy link
Member Author

ebyhr commented Aug 9, 2023

Relates to #18588 (comment)
cc: @findinpath

@hashhar
Copy link
Member

hashhar commented Aug 10, 2023

Seems https://www.baeldung.com/junit-5-extensions can be used to write something that we need.

@martint
Copy link
Member

martint commented Oct 26, 2023

This is done

@martint martint closed this as completed Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants