@ParameterizedTest @ArgumentsSource(TestCaseArgumentsProvider.class) @TestCase({"empty", "null"}) @TestCase({"{null}", "null"}) @TestCase({"A", "A"}) @TestCase({"null,null", "null"}) @TestCase({"null,B", "B"}) @TestCase({"A,B", "A"}) @TestCase({"A,null", "A"}) @TestCase({"1,2,3", "1"}) @TestCase({"null,2,3", "2"}) @TestCase({"null,null,3", "3"}) @TestCase({"null,null,null", "null"}) @TestCase({"1,null,3", "1"}) @TestCase({"1,null,null", "1"}) @TestCase({"1,2,null", "1"}) @TestCase({"null,2,null", "2"}) @TestCase({"null,2,3", "2"}) @TestCase({"null,null,3", "3"}) @TestCase({"1,2,3,4", "1"}) @TestCase({"null,2,3,4", "2"}) @TestCase({"null,null,3,4", "3"}) @TestCase({"null,null,null,4", "4"}) @TestCase({"null,null,null,null", "null"}) @TestCase({"1,null,3,4", "1"}) @TestCase({"1,null,null,4", "1"}) @TestCase({"1,null,null,null", "1"}) @TestCase({"1,2,null,null", "1"}) @TestCase({"1,null,3,null", "1"}) @TestCase({"1,null,null,4", "1"}) @TestCase({"null,2,3,4", "2"}) @TestCase({"null,2,null,4", "2"}) @TestCase({"null,2,3,null", "2"}) @TestCase({"null,2,null,null", "2"}) @TestCase({"null,null,3,4", "3"}) @TestCase({"null,null,3,null", "3"}) @TestCase({"null,null,null,4", "4"}) @TestCase({"1,2,3,4,5", "1"}) @TestCase({"null,2,3,4,5", "2"}) @TestCase({"null,null,3,4,5", "3"}) @TestCase({"null,null,null,4,5", "4"}) @TestCase({"null,null,null,null,5", "5"}) @TestCase({"null,null,null,null", "null"}) @TestCase({"1,null,3,4,5", "1"}) @TestCase({"1,null,null,4,5", "1"}) @TestCase({"1,null,null,null,5", "1"}) @TestCase({"1,null,null,null,null", "1"}) @TestCase({"1,2,null,null,null", "1"}) @TestCase({"1,null,3,null,null", "1"}) @TestCase({"1,null,null,4,null", "1"}) @TestCase({"1,null,null,null,5", "1"}) @TestCase({"null,2,3,4,5", "2"}) @TestCase({"null,2,null,4,5", "2"}) @TestCase({"null,2,3,null,5", "2"}) @TestCase({"null,2,3,4,null", "2"}) @TestCase({"null,2,null,null,null", "2"}) @TestCase({"null,null,3,4,5", "3"}) @TestCase({"null,null,3,null,null", "3"}) @TestCase({"null,null,null,4,null", "4"}) @TestCase({"null,null,null,null,5", "5"}) void coalesceN(String[] input, String expected) { String result = ObjectUtil.coalesce(input); assertThat(result, is(expected)); }
public static <T> T coalesce(T item1, T item2) { return item1 != null ? item1 : item2; }
ObjectUtil extends UtilityClass { public static <T> T coalesce(T item1, T item2) { return item1 != null ? item1 : item2; } }
ObjectUtil extends UtilityClass { public static <T> T coalesce(T item1, T item2) { return item1 != null ? item1 : item2; }  }
ObjectUtil extends UtilityClass { public static <T> T coalesce(T item1, T item2) { return item1 != null ? item1 : item2; }  static T coalesce(T item1, T item2); static T coalesce(T item1, T item2, T item3); static T coalesce(T item1, T item2, T item3, T item4); @SafeVarargs static T coalesce(T... items); }
ObjectUtil extends UtilityClass { public static <T> T coalesce(T item1, T item2) { return item1 != null ? item1 : item2; }  static T coalesce(T item1, T item2); static T coalesce(T item1, T item2, T item3); static T coalesce(T item1, T item2, T item3, T item4); @SafeVarargs static T coalesce(T... items);  }