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

feat: Support @TestFactory in JUnit 5 #699

Merged
merged 2 commits into from
May 16, 2019
Merged

feat: Support @TestFactory in JUnit 5 #699

merged 2 commits into from
May 16, 2019

Conversation

jdneo
Copy link
Member

@jdneo jdneo commented May 15, 2019

Resolve #644

This change overrides the isTestMethod() in the child class. It's because different test frameworks have different restrictions about the method signature. And it's hard to differentiate them in just one method.

demo

@jdneo jdneo added this to the 0.16.1 milestone May 15, 2019
@jdneo jdneo requested review from Eskibear and yaohaizh May 15, 2019 02:22
return false;
}
// 'V' is void signature
if (method.isConstructor() || !"V".equals(method.getReturnType())) {
Copy link
Member

Choose a reason for hiding this comment

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

consider to use constant?

@@ -34,7 +35,19 @@ public TestKind getTestKind() {
public boolean isTestMethod(IMethod method) {
try {
final int flags = method.getFlags();
return Flags.isPublic(flags) && super.isTestMethod(method);
if (Flags.isAbstract(flags) || Flags.isStatic(flags) || !Flags.isPublic(flags)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Lots of duplicate code, should refactor out.

@jdneo jdneo merged commit b4b66d0 into master May 16, 2019
@jdneo jdneo deleted the cs/testfactory branch May 16, 2019 08:01
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.

Support JUnit 5 TestFactory annotation
3 participants