### Question:
Utils { public static <T> List<T> unmodifiableList(List<T> list) { if (list == null) { return Collections.emptyList(); } else if (UNMODIFIABLE_LIST_CLASS.isInstance(list)) { return list; } else { return Collections.unmodifiableList(list); } }  static List<T> unmodifiableList(List<T> list); @SafeVarargs static List<T> varargsToList(T head, T ...tail);  }### Answer:
@Test public void immutableList() throws Exception { assertThrows(UnsupportedOperationException.class, () -> { List<String> xs = Utils.unmodifiableList(new ArrayList<>()); xs.add("element"); }); }
@Test public void doNotWrap() throws Exception { List<String> list = Utils.unmodifiableList(new ArrayList<>()); assertTrue(list == Utils.unmodifiableList(list)); }
@Test public void nonNull() throws Exception { assertNotNull(Utils.unmodifiableList(null)); }