Skip to content

Commit

Permalink
Fixed code review issues
Browse files Browse the repository at this point in the history
  • Loading branch information
FredDeschenes committed Nov 2, 2017
1 parent c3f38e4 commit f08aae5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Expand Up @@ -26,7 +26,7 @@
@Documented
@Constraint(validatedBy = MaxDurationValidator.class)
public @interface MaxDuration {
String message() default "must be less than (or equal if in 'inclusive' mode) to {value} {unit}";
String message() default "must be less than (or equal to, if in 'inclusive' mode) to {value} {unit}";

Class<?>[] groups() default { };

Expand All @@ -43,7 +43,9 @@
TimeUnit unit() default TimeUnit.SECONDS;

/**
* @return if the validation should include the set value (default is true).
* @return {@code true} if the validation is to allow values equal to {@link #value()}.
* False if the validation is to be exclusive.
* Defaults to {@code true}.
*/
boolean inclusive() default true;
}
Expand Up @@ -26,7 +26,7 @@
@Documented
@Constraint(validatedBy = MinDurationValidator.class)
public @interface MinDuration {
String message() default "must be greater than (or equal if in 'inclusive' mode) to {value} {unit}";
String message() default "must be greater than (or equal to, if in 'inclusive' mode) to {value} {unit}";

Class<?>[] groups() default { };

Expand All @@ -43,7 +43,9 @@
TimeUnit unit() default TimeUnit.SECONDS;

/**
* @return if the validation should include the set value (default is true).
* @return {@code true} if the validation is to allow values equal to {@link #value()}.
* False if the validation is to be exclusive.
* Defaults to {@code true}.
*/
boolean inclusive() default true;
}
Expand Up @@ -79,12 +79,12 @@ public void returnsASetOfErrorsForAnObject() throws Exception {
assertThat(errors)
.containsOnly(
"outOfRange must be between 10 MINUTES and 30 MINUTES",
"tooBig must be less than (or equal if in 'inclusive' mode) to 30 SECONDS",
"tooBigExclusive must be less than (or equal if in 'inclusive' mode) to 30 SECONDS",
"tooSmall must be greater than (or equal if in 'inclusive' mode) to 30 SECONDS",
"tooSmallExclusive must be greater than (or equal if in 'inclusive' mode) to 30 SECONDS",
"maxDurs[0].<collection element> must be less than (or equal if in 'inclusive' mode) to 30 SECONDS",
"minDurs[0].<collection element> must be greater than (or equal if in 'inclusive' mode) to 30 SECONDS",
"tooBig must be less than (or equal to, if in 'inclusive' mode) to 30 SECONDS",
"tooBigExclusive must be less than (or equal to, if in 'inclusive' mode) to 30 SECONDS",
"tooSmall must be greater than (or equal to, if in 'inclusive' mode) to 30 SECONDS",
"tooSmallExclusive must be greater than (or equal to, if in 'inclusive' mode) to 30 SECONDS",
"maxDurs[0].<collection element> must be less than (or equal to, if in 'inclusive' mode) to 30 SECONDS",
"minDurs[0].<collection element> must be greater than (or equal to, if in 'inclusive' mode) to 30 SECONDS",
"rangeDurs[0].<collection element> must be between 10 MINUTES and 30 MINUTES");
}
}
Expand Down

0 comments on commit f08aae5

Please sign in to comment.