[go: nahoru, domu]

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 AnnotationValidator, and validation checks for Category (fix for issue #93) #684

Merged
merged 17 commits into from
Oct 24, 2013

Conversation

codingricky
Copy link

Any feedback would be greatly appreciated. Thanks!

@@ -1,5 +1,8 @@
package org.junit.experimental.categories;

import org.junit.experimental.validator.CategoryValidator;
import org.junit.experimental.validator.Validator;
Copy link
Member

Choose a reason for hiding this comment

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

Thinking out loud. Would ValidateWith be more consistent? Curious for your opinion before we make any change.

Copy link
Author

Choose a reason for hiding this comment

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

I actually do prefer ValidateWith, it is a bit more specific. Should I change it?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think so.

@dsaff
Copy link
Member
dsaff commented May 29, 2013

Great start. As I note, the primary concern is trying to make sure that we keep the number of annotation lookups and reflective calls down to a minimum, since some platforms have performance that is easily impacted by such operations. With the right caching, we'll be really close.

@dsaff
Copy link
Member
dsaff commented Jul 1, 2013

I'm really sorry this seems to have dropped off my radar. Taking a look.

import org.junit.runners.model.RunnerScheduler;
import org.junit.runners.model.Statement;
import org.junit.runners.model.TestClass;
import org.junit.runners.model.*;
Copy link
Member

Choose a reason for hiding this comment

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

JUnit style is never to import *

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@dsaff
Copy link
Member
dsaff commented Jul 1, 2013

Big step in the right direction, thanks, and sorry again for dropping the ball on the review.

@codingricky
Copy link
Author

Made the changes as requested. No dramas about forgetting about the change, I kind of forgot about it too.

Thanks for helping out.

@kcooney
Copy link
Member
kcooney commented Aug 1, 2013

@diusricky FYI: this pull cannot be automatically merged. You might want to pull from the main repo, merge the branch, and update the pull request.

import java.util.List;

/**
* Provides an interface with callback methods to validate annotations.
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps simply "Validates annotations on classes and methods. To be validated, an annotation should be annotated with {@link ValidateWith}

Copy link
Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

@codingricky I don't see the above change. Do you still have changes to push to your public repo?


/**
* Gets a {@code Map} between annotations and fields that have
* the annotation in this class or its superclasses.
Copy link
Member

Choose a reason for hiding this comment

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

This should have an @since 4.12 tag

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@codingricky
Copy link
Author

@kcooney I believe I've added all the @SInCE 4.12 annotations.

Thanks.

@stefanbirkner
Copy link
Contributor

@kcooney merging is fine. But I would like to make some additional pull requests before we release JUnit 4.12.

/**
* Miscellaneous functions dealing with {@code Throwable}.
*
* @author kcooney@google.com (Kevin Cooney)
Copy link
Member

Choose a reason for hiding this comment

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

Any idea why this file of Kevin's is sneaking into your pull request?

Copy link
Contributor

Choose a reason for hiding this comment

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

@codingricky You can solve this problem with git rebase master.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks guys, fixed.

On 08/10/2013, at 8:03 AM, David Saff notifications@github.com wrote:

In src/main/java/org/junit/internal/Throwables.java:

@@ -0,0 +1,42 @@
+package org.junit.internal;
+
+/**

  • * Miscellaneous functions dealing with {@code Throwable}.
  • * @author kcooney@google.com (Kevin Cooney)
    Any idea why this file of Kevin's is sneaking into your pull request?


Reply to this email directly or view it on GitHub.

Ricky added 17 commits October 8, 2013 08:25
- Fixed indentation
- Simplified hasValidatorAnnotation method
- Deleted test that was covered elsewhere
- extracted creation of annotation validator into a factory
- added thread saftey around collections
Moved validator to category packages.
Changes around unmodifiable maps.
Made AnnotationValidator abstract.
- ParentRunner now has null object pattern for null annotation validators
- unmodifiableLists are now inserted into the maps of fMethodsForAnnotations and fFieldsForAnnotations
- null value check has been added to the AnnotationValidatorFactory
- Fixed javadoc comment in map getAnnotationToMethods/getAnnotationToFields methods
- Fixed duplicate test for annotationToMethods
…Class

- Removed redundant wrapping of unmodifiableMap in getters of annotationToFields/Methods
…lidators

- added a comment regarding sorting of declared fields
- iterated over map using entry sets and not key sets in TestClass
- refactored the construction of the incompatiable annotations of CategoryValidator to be initialized immediately
@dsaff
Copy link
Member
dsaff commented Oct 7, 2013

Looks in pretty good shape to me. @kcooney, did you have any remaining questions?

@dsaff
Copy link
Member
dsaff commented Oct 14, 2013

Merging! Thanks for the patient work, @codingricky. @kcooney, if any additional concerns come up, let's handle them in a follow-up pull.

@codingricky, can you add a note about this new feature at https://github.com/junit-team/junit/wiki/4.12-release-notes? Thanks!

@codingricky
Copy link
Author

Done!

dsaff pushed a commit that referenced this pull request Oct 24, 2013
Add AnnotationValidator, and validation checks for Category (fix for issue #93)
@dsaff dsaff merged commit da0a727 into junit-team:master Oct 24, 2013
@dsaff
Copy link
Member
dsaff commented Oct 24, 2013

Actually merging. :-P Not sure what happened the first time. Thanks again!

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.

4 participants