Skip to content

Commit 63759d7

Browse files
authored
Add assertions on utility classes in IP module
* Add assertions and comment on the utility class. Added assertion on the utility class, so that it can't be mistakenly ever initialized in the class. * Add exception message for RegexUtils * Add exception message "Class Instantiation not allowed." for the TestingUtilities
1 parent 2a5ddab commit 63759d7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

spring-integration-ip/src/main/java/org/springframework/integration/ip/util/RegexUtils.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ public static String escapeRegexSpecials(String stringToEscape) {
4343
return stringToEscape.replaceAll("([.$\\[\\]^*+{}()\\\\?|])", "\\\\$1");
4444
}
4545

46+
// Non-instantiable utility class
4647
private RegexUtils() {
48+
throw new AssertionError("Class Instantiation not allowed.");
4749
}
4850

4951
}

spring-integration-ip/src/main/java/org/springframework/integration/ip/util/TestingUtilities.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
*/
3434
public final class TestingUtilities {
3535

36+
// Non-instantiable utility class
3637
private TestingUtilities() {
38+
throw new AssertionError("Class Instantiation not allowed.");
3739
}
3840

3941
/**

0 commit comments

Comments
 (0)