Skip to content

Commit

Permalink
Add assertions on utility classes in IP module
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ZahidFKhan committed Jun 30, 2022
1 parent 2a5ddab commit 63759d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ public static String escapeRegexSpecials(String stringToEscape) {
return stringToEscape.replaceAll("([.$\\[\\]^*+{}()\\\\?|])", "\\\\$1");
}

// Non-instantiable utility class
private RegexUtils() {
throw new AssertionError("Class Instantiation not allowed.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
*/
public final class TestingUtilities {

// Non-instantiable utility class
private TestingUtilities() {
throw new AssertionError("Class Instantiation not allowed.");
}

/**
Expand Down

0 comments on commit 63759d7

Please sign in to comment.