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

@RunWith(MetaAnnotations.class) #202

Open
dsaff opened this issue Mar 8, 2011 · 3 comments
Open

@RunWith(MetaAnnotations.class) #202

dsaff opened this issue Mar 8, 2011 · 3 comments
Labels

Comments

@dsaff
Copy link
Member

dsaff commented Mar 8, 2011

Issue #194 suggests treating all annotations as meta-annotations.

While discussions about the relative costs and benefits of that proposal continue, there should be a way (in junit or junit.contrib) for a test developer to "opt-in" to meta-annotations. The obvious thing to try is using a custom runner:

@RunWith(MetaAnnotations.class)
@MetaAnnotationForClass
public class TestClass {
   @MetaAnnotationOnMethod public void foo();
}

Making this work will likely require some method extraction on BlockJUnit4ClassRunner. MetaAnnotations could override getAnnotatedMethods, but statements like

method.getAnnotation(Ignore.class) != null

Would need to be changed to call a protected method:

 getAnnotation(method, Ignore.class) != null

So that MetaAnnotations could override getAnnotation.

@nealeu
Copy link

nealeu commented Mar 9, 2011

This sounds a pragmatic way forwards.

@dsaff
Copy link
Member Author

dsaff commented Mar 9, 2011

Excellent.

@kcooney
Copy link
Member

kcooney commented Jan 29, 2014

I'm not sure this is a good path forward. A class can only have one runner. If you wanted to use Parameterized or Theories, you couldn't use MetaAnnotations

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

No branches or pull requests

3 participants