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

Inheritance of Categories #558

Closed
gaffa opened this issue Nov 29, 2012 · 7 comments
Closed

Inheritance of Categories #558

gaffa opened this issue Nov 29, 2012 · 7 comments

Comments

@gaffa
Copy link
Contributor

gaffa commented Nov 29, 2012

I need to Annotate all our IntegrationTests. As I realized they all inherit from only like 3 different abstract tests I felt like maybe I am ready already because I simply can annotate the abstract class. Just that this behaviour is not as expected.

Example:

@category(IT.class)
public class A{
@test
public void testInAnnotatedClass() {
System.out.println("inheritance: method in annotated class ran.");
}
}

public class B extends A{
@test
public void testInInheritingClass() {
System.out.println("inheritance: method in inheriting class ran.");
}
}

Running this will result in only testInAnnotatedClass() being ran.

@Tibor17
Copy link
Contributor

Tibor17 commented Nov 29, 2012

If the Category annotation was annotated by java.lang.annotation.Inherited, then the test B would be category as well.

@gaffa
Copy link
Contributor Author

gaffa commented Dec 3, 2012

I have cloned your repo and implemented the functionality with an optional Parameter "inherited" in Category that defaults to false. I further changed the Categories-Runner to evaluate this Parameter and support inheritance. This does not change the current behaviour but supports optional inheritance. Im just too dumb to understand how to ask you to merge it back :)
Its only one commit containing a one-line-change to Category one Method in Categories and some Code changes in Categories. I also added a simple test demonstrating that no changes to default behaviour are made and that the optional inheritance works.

@dsaff
Copy link
Member

dsaff commented Dec 3, 2012

@gaffa, there should be a "Pull Request" button at the top of your fork. That should get you on your way to creating an official pull request. Thanks!

@gaffa
Copy link
Contributor Author

gaffa commented Dec 3, 2012

Perfect. Thank you!

@gaffa
Copy link
Contributor Author

gaffa commented Dec 3, 2012

@other people interested in this: http://tech.groups.yahoo.com/group/junit/surveys?id=3125322

@avandeursen
Copy link
Contributor

It looks like this issue can be closed as it has been resolved by pull request #566

@dsaff
Copy link
Member

dsaff commented Jan 10, 2013

Agreed.

@dsaff dsaff closed this as completed Jan 10, 2013
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

No branches or pull requests

4 participants