- try {
- Field parentNameField = testReferenceKey.getClass().getDeclaredField("parentKeyName");
- parentNameField.setAccessible(true);
- parentNameField.set(testReferenceKey, "Parent Name");
- AxValidationResult validationResult = new AxValidationResult();
- testReferenceKey.validate(validationResult);
- parentNameField.set(testReferenceKey, "ParentName");
- parentNameField.setAccessible(false);
- assertEquals(
- "parentKeyName invalid-parameter parentKeyName with value Parent Name "
- + "does not match regular expression [A-Za-z0-9\\-_\\.]+",
- validationResult.getMessageList().get(0).getMessage());
- } catch (Exception validationException) {
- fail("test should not throw an exception");
- }
-
- try {
- Field parentVersionField = testReferenceKey.getClass().getDeclaredField("parentKeyVersion");
- parentVersionField.setAccessible(true);
- parentVersionField.set(testReferenceKey, "Parent Version");
- AxValidationResult validationResult = new AxValidationResult();
- testReferenceKey.validate(validationResult);
- parentVersionField.set(testReferenceKey, "0.0.1");
- parentVersionField.setAccessible(false);
- assertEquals(
- "parentKeyVersion invalid-parameter parentKeyVersion with value Parent Version "
- + "does not match regular expression [A-Za-z0-9.]+",
- validationResult.getMessageList().get(0).getMessage());
- } catch (Exception validationException) {
- fail("test should not throw an exception");
- }
-
- try {
- Field parentLocalNameField = testReferenceKey.getClass().getDeclaredField("parentLocalName");
- parentLocalNameField.setAccessible(true);
- parentLocalNameField.set(testReferenceKey, "Parent Local Name");
- AxValidationResult validationResult = new AxValidationResult();
- testReferenceKey.validate(validationResult);
- parentLocalNameField.set(testReferenceKey, "ParentLocalName");
- parentLocalNameField.setAccessible(false);
- assertEquals(
- "parentLocalName invalid-parameter parentLocalName with value "
- + "Parent Local Name does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
- validationResult.getMessageList().get(0).getMessage());
- } catch (Exception validationException) {
- fail("test should not throw an exception");
- }
-
- try {
- Field localNameField = testReferenceKey.getClass().getDeclaredField("localName");
- localNameField.setAccessible(true);
- localNameField.set(testReferenceKey, "Local Name");
- AxValidationResult validationResult = new AxValidationResult();
- testReferenceKey.validate(validationResult);
- localNameField.set(testReferenceKey, "LocalName");
- localNameField.setAccessible(false);
- assertEquals(
- "localName invalid-parameter localName with value Local Name "
- + "does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
- validationResult.getMessageList().get(0).getMessage());
- } catch (Exception validationException) {
- fail("test should not throw an exception");
- }
+ Field parentNameField = testReferenceKey.getClass().getDeclaredField("parentKeyName");
+ parentNameField.setAccessible(true);
+ parentNameField.set(testReferenceKey, "Parent Name");
+ AxValidationResult validationResult = new AxValidationResult();
+ testReferenceKey.validate(validationResult);
+ parentNameField.set(testReferenceKey, "ParentName");
+ parentNameField.setAccessible(false);
+ assertEquals(
+ "parentKeyName invalid-parameter parentKeyName with value Parent Name "
+ + "does not match regular expression [A-Za-z0-9\\-_\\.]+",
+ validationResult.getMessageList().get(0).getMessage());
+
+ Field parentVersionField = testReferenceKey.getClass().getDeclaredField("parentKeyVersion");
+ parentVersionField.setAccessible(true);
+ parentVersionField.set(testReferenceKey, "Parent Version");
+ AxValidationResult validationResultPV = new AxValidationResult();
+ testReferenceKey.validate(validationResultPV);
+ parentVersionField.set(testReferenceKey, "0.0.1");
+ parentVersionField.setAccessible(false);
+ assertEquals(
+ "parentKeyVersion invalid-parameter parentKeyVersion with value Parent Version "
+ + "does not match regular expression [A-Za-z0-9.]+",
+ validationResultPV.getMessageList().get(0).getMessage());
+
+ Field parentLocalNameField = testReferenceKey.getClass().getDeclaredField("parentLocalName");
+ parentLocalNameField.setAccessible(true);
+ parentLocalNameField.set(testReferenceKey, "Parent Local Name");
+ AxValidationResult validationResultPL = new AxValidationResult();
+ testReferenceKey.validate(validationResultPL);
+ parentLocalNameField.set(testReferenceKey, "ParentLocalName");
+ parentLocalNameField.setAccessible(false);
+ assertEquals(
+ "parentLocalName invalid-parameter parentLocalName with value "
+ + "Parent Local Name does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
+ validationResultPL.getMessageList().get(0).getMessage());
+
+ Field localNameField = testReferenceKey.getClass().getDeclaredField("localName");
+ localNameField.setAccessible(true);
+ localNameField.set(testReferenceKey, "Local Name");
+ AxValidationResult validationResultLN = new AxValidationResult();
+ testReferenceKey.validate(validationResultLN);
+ localNameField.set(testReferenceKey, "LocalName");
+ localNameField.setAccessible(false);
+ assertEquals(
+ "localName invalid-parameter localName with value Local Name "
+ + "does not match regular expression [A-Za-z0-9\\-_\\.]+|^$",
+ validationResultLN.getMessageList().get(0).getMessage());
+