Skip to content

Commit

Permalink
[#11878] Change institute length limit (#12974)
Browse files Browse the repository at this point in the history
* Change institute name max length to 128

* Edit test case for new length limit
  • Loading branch information
xenosf committed Apr 2, 2024
1 parent 99eeac7 commit 7ec74c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/teammates/common/util/FieldValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class FieldValidator {
public static final int SECTION_NAME_MAX_LENGTH = 60;

public static final String INSTITUTE_NAME_FIELD_NAME = "institute name";
public static final int INSTITUTE_NAME_MAX_LENGTH = 64;
public static final int INSTITUTE_NAME_MAX_LENGTH = 128;

// email-related
public static final String EMAIL_FIELD_NAME = "email";
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/teammates/common/util/FieldValidatorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ public void testGetInvalidityInfoForInstituteName_invalid_returnSpecificErrorStr
String invalidInstituteName = StringHelperExtension.generateStringOfLength(
FieldValidator.INSTITUTE_NAME_MAX_LENGTH + 1);
String actual = FieldValidator.getInvalidityInfoForInstituteName(invalidInstituteName);
String expectedTemplate = "\"%s\" is not "
+ "acceptable to TEAMMATES as a/an institute name because it is too long. The value "
+ "of a/an institute name should be no longer than 128 characters. It should not be empty.";
String expected = String.format(expectedTemplate, invalidInstituteName);
assertEquals("Invalid institute name (too long) should return error message that is specific to institute name",
"\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" is not "
+ "acceptable to TEAMMATES as a/an institute name because it is too long. The value "
+ "of a/an institute name should be no longer than 64 characters. It should not be empty.",
actual);
expected, actual);
}

@Test
Expand Down

0 comments on commit 7ec74c7

Please sign in to comment.