child.setName("First born");
child.setScaleFactor(40);
child.setParent(parent);
parent.getChildren().add(child);
validator.setRootObject(child);
ValidatorMessage message = (ValidatorMessage) validator.validate(40, "scaleFactor");
assertFalse(message.hasError());
child = new DomainChild();
child.setName("Favorite child");
child.setScaleFactor(60);
child.setParent(parent);
parent.getChildren().add(child);
validator.setRootObject(child);
message = (ValidatorMessage) validator.validate(60, "scaleFactor");
assertFalse(message.hasError());
child = new DomainChild();
child.setScaleFactor(0);
child.setParent(parent);
parent.getChildren().add(child);
validator.setRootObject(child);
message = (ValidatorMessage) validator.validate("", "name");
assertTrue(message.hasError());
child = new DomainChild();
child.setName("Wild child");
child.setScaleFactor(30);
child.setParent(parent);
parent.getChildren().add(child);
validator.setRootObject(child);
message = (ValidatorMessage) validator.validate(30, "scaleFactor");
assertTrue(message.hasError());
}