Source:
public void testGetInvalidStateInfo() throws Exception { ______TS("valid account"); AccountAttributes account = createValidAccountAttributesObject(); assertTrue("all valid values", account.isValid()); ______TS("null studentProfile"); account.studentProfile = null; try { account.isValid(); signalFailureToDetectException(" - AssertionError"); } catch (AssertionError ae) { assertEquals("Non-null value expected for studentProfile", ae.getMessage()); } ______TS("invalid account"); account = createInvalidAccountAttributesObject(); String expectedError = getPopulatedEmptyStringErrorMessage( FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE_EMPTY_STRING, FieldValidator.PERSON_NAME_FIELD_NAME, FieldValidator.PERSON_NAME_MAX_LENGTH) + EOL + getPopulatedErrorMessage( FieldValidator.GOOGLE_ID_ERROR_MESSAGE, "invalid google id", FieldValidator.GOOGLE_ID_FIELD_NAME, FieldValidator.REASON_INCORRECT_FORMAT, FieldValidator.GOOGLE_ID_MAX_LENGTH) + EOL + getPopulatedErrorMessage( FieldValidator.EMAIL_ERROR_MESSAGE, "invalid@email@com", FieldValidator.EMAIL_FIELD_NAME, FieldValidator.REASON_INCORRECT_FORMAT, FieldValidator.EMAIL_MAX_LENGTH) + EOL + getPopulatedErrorMessage( FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", FieldValidator.INSTITUTE_NAME_FIELD_NAME, FieldValidator.REASON_TOO_LONG, FieldValidator.INSTITUTE_NAME_MAX_LENGTH); assertFalse("all valid values", account.isValid()); assertEquals("all valid values", expectedError, StringHelper.toString(account.getInvalidityInfo())); }

Target:
public void testGetInvalidStateInfo() throws Exception { ______TS("valid account"); AccountAttributes account = createValidAccountAttributesObject(); assertTrue("all valid values", account.isValid()); ______TS("null studentProfile"); account.studentProfile = null; try { account.isValid(); signalFailureToDetectException(" - AssertionError"); } catch (AssertionError ae) { assertEquals("Non-null value expected for studentProfile", ae.getMessage()); } ______TS("invalid account"); account = createInvalidAccountAttributesObject(); String expectedError = getPopulatedEmptyStringErrorMessage( FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE_EMPTY_STRING, FieldValidator.PERSON_NAME_FIELD_NAME, FieldValidator.PERSON_NAME_MAX_LENGTH) + System.lineSeparator() + getPopulatedErrorMessage( FieldValidator.GOOGLE_ID_ERROR_MESSAGE, "invalid google id", FieldValidator.GOOGLE_ID_FIELD_NAME, FieldValidator.REASON_INCORRECT_FORMAT, FieldValidator.GOOGLE_ID_MAX_LENGTH) + System.lineSeparator() + getPopulatedErrorMessage( FieldValidator.EMAIL_ERROR_MESSAGE, "invalid@email@com", FieldValidator.EMAIL_FIELD_NAME, FieldValidator.REASON_INCORRECT_FORMAT, FieldValidator.EMAIL_MAX_LENGTH) + System.lineSeparator() + getPopulatedErrorMessage( FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", FieldValidator.INSTITUTE_NAME_FIELD_NAME, FieldValidator.REASON_TOO_LONG, FieldValidator.INSTITUTE_NAME_MAX_LENGTH); assertFalse("all valid values", account.isValid()); assertEquals("all valid values", expectedError, StringHelper.toString(account.getInvalidityInfo())); }