@Test public final void testValidate() { try { MembersCommand cmd = new MembersCommand(); Errors errors = new BindException(cmd, "MembersCommand"); cmd.setActionCmd(MembersCommand.ACTION_MOVE_TARGETS); testInstance.validate(cmd, errors); assertEquals("Expecting 1 errors", 1, errors.getErrorCount()); assertEquals("Expecting error[0]", true, errors.getAllErrors().toArray()[0].toString().contains("groups.errors.members.must_select")); } catch (Exception e) { String message = e.getClass().toString() + " - " + e.getMessage(); log.debug(message); fail(message); } }
public void validate(Object comm, Errors errors) { MembersCommand command = (MembersCommand) comm; if(MembersCommand.ACTION_MOVE_TARGETS.equals(command.getActionCmd())) { if(command.getTargetOids() == null || command.getTargetOids().length == 0) { errors.reject("groups.errors.members.must_select"); } } }
MembersValidator extends AbstractBaseValidator { public void validate(Object comm, Errors errors) { MembersCommand command = (MembersCommand) comm; if(MembersCommand.ACTION_MOVE_TARGETS.equals(command.getActionCmd())) { if(command.getTargetOids() == null || command.getTargetOids().length == 0) { errors.reject("groups.errors.members.must_select"); } } } }
MembersValidator extends AbstractBaseValidator { public void validate(Object comm, Errors errors) { MembersCommand command = (MembersCommand) comm; if(MembersCommand.ACTION_MOVE_TARGETS.equals(command.getActionCmd())) { if(command.getTargetOids() == null || command.getTargetOids().length == 0) { errors.reject("groups.errors.members.must_select"); } } }  }
MembersValidator extends AbstractBaseValidator { public void validate(Object comm, Errors errors) { MembersCommand command = (MembersCommand) comm; if(MembersCommand.ACTION_MOVE_TARGETS.equals(command.getActionCmd())) { if(command.getTargetOids() == null || command.getTargetOids().length == 0) { errors.reject("groups.errors.members.must_select"); } } }  boolean supports(Class clazz); void validate(Object comm, Errors errors); }
MembersValidator extends AbstractBaseValidator { public void validate(Object comm, Errors errors) { MembersCommand command = (MembersCommand) comm; if(MembersCommand.ACTION_MOVE_TARGETS.equals(command.getActionCmd())) { if(command.getTargetOids() == null || command.getTargetOids().length == 0) { errors.reject("groups.errors.members.must_select"); } } }  boolean supports(Class clazz); void validate(Object comm, Errors errors);  }