Utils { public static String getValue(final String value, final String defaultValue) { return (value != null && !value.isEmpty() ? value : defaultValue); }  static String toXMLDateTime(final Date date); static Date fromXMLDateTime(final String xmlDateTimeString); static String detectMimeType(final File f); static String getExtension(final String mimeType); static Path createFileWithUniqueName(final String baseName); static void sortFiles(final File array[]); static String getKeyByValue(final Map<String, String> map, final String value); static int compareStrings(final String s, final String p); static String getValue(final String value, final String defaultValue); static boolean isNullOrEmpty(final String s); static boolean isNullOrEmpty(final Collection<?> c); static boolean isNullOrEmpty(final Map<?,?> m); static boolean isNullOrEmpty(final Iterator<?> i); static Throwable getRootCause(final Throwable t); static List<Throwable> getCauses(final Throwable t); static String getExceptionTrace(final Throwable t); static boolean nullSafeEqual(final T o1, final T o2); static boolean nullSafeEqualIgnoreCase(final String s1, final String s2); static boolean isValidURI(final String uri); static boolean isTrue(String value);  }
@Test public void testGetValue() { assertEquals("default", Utils.getValue(null, "default")); assertEquals("default", Utils.getValue("", "default")); assertEquals("data", Utils.getValue("data", "default")); }