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

@Target(ANNOTATION_TYPE) for @ValidateWith, fixes #1611 #1612

Merged
merged 3 commits into from
Oct 18, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/org/junit/validator/ValidateWith.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.junit.validator;

import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Allows for an {@link AnnotationValidator} to be attached to an annotation.
Expand All @@ -13,6 +15,7 @@
* @since 4.12
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
@Inherited
public @interface ValidateWith {
Class<? extends AnnotationValidator> value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void createAnnotationValidator() {
}

@ValidateWith(value = Validator.class)
public static class SampleTestWithValidator {
public @interface SampleTestWithValidator {
Copy link
Member

Choose a reason for hiding this comment

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

nit: maybe rename "SampleTestWithValidator" to "AnnotationWithValidator" or "SampleAnnotationWithValidator"?

(same thing below)

}

public static class Validator extends AnnotationValidator {
Expand All @@ -36,7 +36,7 @@ public void exceptionWhenAnnotationValidatorCantBeCreated() {
}

@ValidateWith(value = ValidatorThatThrowsException.class)
public static class SampleTestWithValidatorThatThrowsException {
public @interface SampleTestWithValidatorThatThrowsException {
}

public static class ValidatorThatThrowsException extends AnnotationValidator {
Expand Down