Change error message for positive integer

This commit is contained in:
Kris De Volder
2019-05-09 09:15:24 -07:00
parent ac2408dddd
commit 84f0e6f668
2 changed files with 3 additions and 7 deletions

View File

@@ -39,11 +39,7 @@ public class ValueParsers {
str = str.replace("_", ""); //Tolerate and ignore underscores in integers.
int value = Integer.parseInt(str);
if (lowerBound!=null && value<lowerBound) {
if (lowerBound==0) {
throw new NumberFormatException("Value must be positive");
} else {
throw new NumberFormatException("Value must be at least "+lowerBound);
}
throw new NumberFormatException("Value must be at least "+lowerBound);
}
if (upperBound!=null && value>upperBound) {
throw new NumberFormatException("Value must be at most "+upperBound);

View File

@@ -513,7 +513,7 @@ public class ConcourseEditorTest {
);
editor.assertProblems(
"boohoo|boolean",
"-1|must be positive",
"-1|must be at least 0",
"git|resource does not exist",
"yohoho|boolean",
"0|must be at least 1",
@@ -1338,7 +1338,7 @@ public class ConcourseEditorTest {
" clean_tags: not-bool-d\n"
);
editor.assertProblems(
"-1|must be positive",
"-1|must be at least 0",
"not-bool-a|'boolean'",
"not-bool-b|'boolean'",
"not-bool-c|'boolean'",