StringUtil { public static boolean equals(String text1, String text2) { if (text1 == null) { return (text2 == null); } return text1.equals(text2); }  static String collapsePathDots(String path); static boolean isNotBlank(String text); static boolean isBlank(String text); static boolean isEmpty(String text); static boolean endsWithIgnoreCase(String source, String suffix); static String defaultIfNull(String text); static String defaultIfNull(String text, String defaultValue); static boolean equals(String text1, String text2); static String toString(Object... keyValues); static int hashCode(String... values); static String substringBefore(String text, char separator); static String substringBeforeLast(String text, char separator); static String substringAfterLast(String text, char separator); static String substringAfter(String text, char c);  }
@Test public void testEquals() { Object[] testData = new Object[] { null, null, true, "", "", true, null, "", false, "", null, false, null, "foo", false, "foo", null, false, "", "foo", false, "foo", "", false, "foo", "bar", false, "foo", "foo", true }; for (int i = 0; i < testData.length; i += 3) { boolean actualResult = StringUtil.equals((String) testData[i], (String) testData[i + 1]); boolean expectedResult = (Boolean) testData[i + 2]; assertEquals( (i / 3) + " : " + testData[i] + ", " + testData[i + 1], expectedResult, actualResult); } }