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
This commit is contained in:
Zahid Khan
2022-07-01 01:24:22 +05:30
committed by GitHub
parent 2a5ddabd26
commit 63759d76b9
2 changed files with 4 additions and 0 deletions

View File

@@ -43,7 +43,9 @@ public final class RegexUtils {
return stringToEscape.replaceAll("([.$\\[\\]^*+{}()\\\\?|])", "\\\\$1");
}
// Non-instantiable utility class
private RegexUtils() {
throw new AssertionError("Class Instantiation not allowed.");
}
}

View File

@@ -33,7 +33,9 @@ import org.springframework.lang.Nullable;
*/
public final class TestingUtilities {
// Non-instantiable utility class
private TestingUtilities() {
throw new AssertionError("Class Instantiation not allowed.");
}
/**