コード例 #1
0
 @Test
 public void testHasOpNonStringExpression() {
   FormValidation validation = testValidator.validateFilterExpression("VersionCounter has 1");
   assertEquals(
       "Invalid if has operator used with number", FormValidation.Kind.WARNING, validation.kind);
   validation = testValidator.validateFilterExpression("VersionCounter has True");
   assertEquals(
       "Invalid if has operator used with boolean", FormValidation.Kind.WARNING, validation.kind);
 }
コード例 #2
0
 @Test
 public void testMissingQuoteExpression() {
   FormValidation validation = testValidator.validateFilterExpression("Name = 'test");
   assertEquals(
       "Invalid if closing quotation mark is missing",
       FormValidation.Kind.WARNING,
       validation.kind);
   validation = testValidator.validateFilterExpression("Name = test\"");
   assertEquals(
       "Invalid if opening quotation mark is missing",
       FormValidation.Kind.WARNING,
       validation.kind);
 }
コード例 #3
0
 @Test
 public void testRelOpNotNumberExpression() {
   FormValidation validation = testValidator.validateFilterExpression("Name > 'test'");
   assertEquals(
       "Invalid if relational operator used with string",
       FormValidation.Kind.WARNING,
       validation.kind);
   validation = testValidator.validateFilterExpression("VersionCounter >= False'");
   assertEquals(
       "Invalid if relational operator used with boolean",
       FormValidation.Kind.WARNING,
       validation.kind);
 }
コード例 #4
0
 @Test
 public void testSingleQuotedExpression() {
   final FormValidation validation =
       testValidator.validateFilterExpression("'Test Comment' = 'test'");
   assertEquals(
       "Valid if single quotes used with string", FormValidation.Kind.OK, validation.kind);
 }
コード例 #5
0
 @Test
 public void testEqualsOpNumberExpression() {
   final FormValidation validation =
       testValidator.validateFilterExpression("'Estimated Duration [min]'=1");
   assertEquals(
       "Valid if equals operator used with number", FormValidation.Kind.OK, validation.kind);
 }
コード例 #6
0
 @Test
 public void testInvalidParameterName() {
   final FormValidation validation = testValidator.validateParameterName("123param");
   assertEquals(
       "Invalid parameter name starts with non-letter char",
       FormValidation.Kind.ERROR,
       validation.kind);
 }
コード例 #7
0
 @Test
 public void testMissingBracketExpression() {
   final FormValidation validation = testValidator.validateFilterExpression("(Name='test'");
   assertEquals(
       "Error if bracket missing in filter expression",
       FormValidation.Kind.WARNING,
       validation.kind);
 }
コード例 #8
0
 @Test
 public void testValidComplexExpression() {
   final FormValidation validation =
       testValidator.validateFilterExpression(
           "(Name=\"test\" and (Status='FAILED' or 'Test Comment' has 't?st*') "
               + "or 'Execution Priority'>=1 and VersionCounter=True)");
   assertEquals("Valid complex filter expression", FormValidation.Kind.OK, validation.kind);
 }
コード例 #9
0
 @Test
 public void testInvalidConstantName() {
   final FormValidation validation = testValidator.validateGlobalConstantName("123constant");
   assertEquals(
       "Invalid global constant name starts with non-letter char",
       FormValidation.Kind.ERROR,
       validation.kind);
 }
コード例 #10
0
 @Test
 public void testInvalidAlphanumericConstantName() {
   final FormValidation validation = testValidator.validateGlobalConstantName("!constant123");
   assertEquals(
       "Error if global constant name is not alphanumeric",
       FormValidation.Kind.ERROR,
       validation.kind);
 }
コード例 #11
0
 @Test
 public void testValidConstantValue() {
   final FormValidation validation = testValidator.validateGlobalConstantValue("value");
   assertEquals(
       "Valid global constant value starts with a letter char",
       FormValidation.Kind.OK,
       validation.kind);
 }
コード例 #12
0
 @Test
 public void testParameterizedConstantValue() {
   final FormValidation validation = testValidator.validateGlobalConstantValue("${VALUE}");
   assertEquals(
       "Warning if parameterized global constant value",
       FormValidation.Kind.WARNING,
       validation.kind);
 }
コード例 #13
0
 @Test
 public void testMissingLogicOperatorExpression() {
   final FormValidation validation =
       testValidator.validateFilterExpression("Name='test' Status='FAILED'");
   assertEquals(
       "Error if logical operator missing in filter expression",
       FormValidation.Kind.WARNING,
       validation.kind);
 }
コード例 #14
0
 @Test
 public void testRelOpNumberExpression() {
   FormValidation validation = testValidator.validateFilterExpression("VersionCounter < 1");
   assertEquals(
       "Valid if less than operator used with number", FormValidation.Kind.OK, validation.kind);
   validation = testValidator.validateFilterExpression("VersionCounter > 1");
   assertEquals(
       "Valid if greater than operator used with number", FormValidation.Kind.OK, validation.kind);
   validation = testValidator.validateFilterExpression("VersionCounter <= 1");
   assertEquals(
       "Valid if less than equals operator used with number",
       FormValidation.Kind.OK,
       validation.kind);
   validation = testValidator.validateFilterExpression("VersionCounter >= 1");
   assertEquals(
       "Valid if greater than equals operator used with number",
       FormValidation.Kind.OK,
       validation.kind);
 }
コード例 #15
0
 @Test
 public void testNullParameterValue() {
   final FormValidation validation = testValidator.validateParameterValue(null);
   assertEquals("Error if empty parameter value", FormValidation.Kind.ERROR, validation.kind);
 }
コード例 #16
0
 @Test
 public void testDoubleQuotedExpression() {
   final FormValidation validation = testValidator.validateFilterExpression("Name = \"test\"");
   assertEquals(
       "Valid if double quotes used with string", FormValidation.Kind.OK, validation.kind);
 }
コード例 #17
0
 @Test
 public void testNullConstantValue() {
   final FormValidation validation = testValidator.validateGlobalConstantValue(null);
   assertEquals(
       "Error if empty global constant value", FormValidation.Kind.ERROR, validation.kind);
 }
コード例 #18
0
 // Validation of global constants parameters
 @Test
 public void testEmptyConstantName() {
   final FormValidation validation = testValidator.validateGlobalConstantName("");
   assertEquals("Error if empty global constant name", FormValidation.Kind.ERROR, validation.kind);
 }
コード例 #19
0
 @Test
 public void testBooleanFilterExpression() {
   final FormValidation validation = testValidator.validateFilterExpression("VersionCounter=True");
   assertEquals("Valid boolean filter expression", FormValidation.Kind.OK, validation.kind);
 }
コード例 #20
0
 @Test
 public void testNumericFilterExpression() {
   final FormValidation validation =
       testValidator.validateFilterExpression("'Estimated Duration [min]'=1");
   assertEquals("Valid numeric filter expression", FormValidation.Kind.OK, validation.kind);
 }
コード例 #21
0
 @Test
 public void testNullProjectFile() {
   final FormValidation validation = testValidator.validateProjectFile(null);
   assertEquals("Error if project file not defined", FormValidation.Kind.ERROR, validation.kind);
 }
コード例 #22
0
 @Test
 public void testInvalidPackageFile() {
   final FormValidation validation = testValidator.validatePackageFile("test");
   assertEquals("Error if invalid package file", FormValidation.Kind.ERROR, validation.kind);
 }
コード例 #23
0
 @Test
 public void testInvalidExpression() {
   final FormValidation validation = testValidator.validateFilterExpression("invalid filter");
   assertEquals(
       "Error if invalid filter expression", FormValidation.Kind.WARNING, validation.kind);
 }
コード例 #24
0
 // Validation of package parameters
 @Test
 public void testEmptyParameterName() {
   final FormValidation validation = testValidator.validateParameterName("");
   assertEquals("Error if empty parameter name", FormValidation.Kind.ERROR, validation.kind);
 }
コード例 #25
0
 @Test
 public void testValidPackageFile() {
   final FormValidation validation = testValidator.validatePackageFile("test.pkg");
   assertEquals("Valid package file has .pkg extension", FormValidation.Kind.OK, validation.kind);
 }
コード例 #26
0
 @Test
 public void testParameterizedParameterValue() {
   final FormValidation validation = testValidator.validateParameterValue("${VALUE}");
   assertEquals(
       "Warning if parameterized parameter value", FormValidation.Kind.WARNING, validation.kind);
 }
コード例 #27
0
 // Validation of project file
 @Test
 public void testEmptyProjectFile() {
   final FormValidation validation = testValidator.validateProjectFile("");
   assertEquals("Error if empty project file", FormValidation.Kind.ERROR, validation.kind);
 }
コード例 #28
0
 @Test
 public void testValidParameterValue() {
   final FormValidation validation = testValidator.validateParameterValue("value");
   assertEquals(
       "Valid parameter value starts with a letter char", FormValidation.Kind.OK, validation.kind);
 }
コード例 #29
0
 @Test
 public void testParameterizedProjectFile() {
   final FormValidation validation = testValidator.validateProjectFile("${TEST}");
   assertEquals(
       "Warning if parameterized project file", FormValidation.Kind.WARNING, validation.kind);
 }
コード例 #30
0
 @Test
 public void testHasnotOpStringExpression() {
   final FormValidation validation = testValidator.validateFilterExpression("Name hasnot 'test'");
   assertEquals(
       "Valid if hasnot operator used with string", FormValidation.Kind.OK, validation.kind);
 }