ResourceUtils { public static <T> List<T> getListFromNullable(@Nullable List<T> list) { if (list == null) { return ImmutableList.of(); } else { return list; } }  static Optional<String> getOptionalForParameter(String parameterStr); static Optional<Integer> getOptionalForParameterAsInt(String parameterStr); static Optional<Boolean> getOptionalForParameterAsBool(String parameterStr); static List<T> getListFromNullable(@Nullable List<T> list);  }
@Test public void testGetListFromNullable() { assertEquals(ImmutableList.of(), ResourceUtils.getListFromNullable(null)); List<String> test = Lists.newArrayList("a", "b"); assertEquals(test, ResourceUtils.getListFromNullable(test)); }