@Test
 public void shouldNotHaveAnyErrorsWhenAllFieldsCorrectAndPresent() throws Exception {
   InvitationSentRecord record =
       InvitationSentRecord.toInvitationSentRecord("SLOTS", "IOS", "[email protected],[email protected]");
   Errors errors = new BeanPropertyBindingResult(record, "record");
   validator.validate(record, errors);
   assertEquals(0, errors.getErrorCount());
 }
 @Test
 public void shouldAddErrorWhenEmptySourceIds() throws Exception {
   InvitationSentRecord record = InvitationSentRecord.toInvitationSentRecord("SLOTS", "IOS", "");
   Errors errors = new BeanPropertyBindingResult(record, "record");
   validator.validate(record, errors);
   FieldError fieldError = errors.getFieldError("sourceIds");
   assertEquals("sourceIds must be present", fieldError.getDefaultMessage());
   assertEquals("empty", fieldError.getCode());
 }
 @Test
 public void shouldAddErrorWhenNullPlatform() throws Exception {
   InvitationSentRecord record =
       InvitationSentRecord.toInvitationSentRecord("SLOTS", null, "*****@*****.**");
   Errors errors = new BeanPropertyBindingResult(record, "record");
   validator.validate(record, errors);
   FieldError fieldError = errors.getFieldError("platform");
   assertEquals("platform must be present", fieldError.getDefaultMessage());
   assertEquals("empty", fieldError.getCode());
 }
 @Test
 public void shouldAddErrorWhenUnknownGame() throws Exception {
   InvitationSentRecord record =
       InvitationSentRecord.toInvitationSentRecord("BLACKJACK", "IOS", "*****@*****.**");
   Errors errors = new BeanPropertyBindingResult(record, "record");
   validator.validate(record, errors);
   FieldError fieldError = errors.getFieldError("gameType");
   assertEquals("gameType is not supported", fieldError.getDefaultMessage());
   assertEquals("unsupported", fieldError.getCode());
 }
 @Test
 public void shouldAddErrorWhenSourceIDIsBlank() {
   InvitationSentRecord record =
       InvitationSentRecord.toInvitationSentRecord("SLOTS", "IOS", ",1002222223");
   Errors errors = new BeanPropertyBindingResult(record, "record");
   validator.validate(record, errors);
   FieldError fieldError = errors.getFieldError("sourceIds");
   assertEquals("sourceIds cannot be blank", fieldError.getDefaultMessage());
   assertEquals("nullOrBlankSourceId", fieldError.getCode());
 }
 @Test
 public void shouldAddErrorWhenInvalidPlatform() throws Exception {
   InvitationSentRecord record =
       InvitationSentRecord.toInvitationSentRecord("SLOTS", "PLAYSTATION", "*****@*****.**");
   Errors errors = new BeanPropertyBindingResult(record, "record");
   validator.validate(record, errors);
   FieldError fieldError = errors.getFieldError("platform");
   assertEquals("platform is not supported", fieldError.getDefaultMessage());
   assertEquals("unsupported", fieldError.getCode());
 }
 @Test
 public void shouldNotSupportOnAnyOtherClass() throws Exception {
   assertFalse(validator.supports(BigDecimal.class));
   assertFalse(validator.supports(Object.class));
 }
 @Test
 public void shouldSupportInvitationRequestClass() throws Exception {
   assertTrue(validator.supports(InvitationSentRecord.class));
 }