### Question:
JoinOnComma implements Function<Object, String> { public String apply(Object o) { checkNotNull(o, "input cannot be null"); if (o.getClass().isArray()) { Builder<Object> builder = ImmutableList.builder(); for (int i = 0; i < Array.getLength(o); i++) builder.add(Array.get(o, i)); o = builder.build(); } checkArgument(o instanceof Iterable<?>, "you must pass an iterable or array"); Iterable<?> toJoin = (Iterable<?>) o; checkArgument(!Iterables.isEmpty(toJoin), "you must pass an iterable or array with elements"); return Joiner.on(',').join(toJoin); }  String apply(Object o);  }### Answer:
@Test public void testIterableLong() { String list = new JoinOnComma().apply(ImmutableList.of(1L, 2L)); assertEquals(list, "1,2"); }
@Test public void testLongArray() { String list = new JoinOnComma().apply(new long[] { 1L, 2L }); assertEquals(list, "1,2"); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptyArrayIllegalArgumentException() { new JoinOnComma().apply(new long[] {}); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testEmptyIterableIllegalArgumentException() { new JoinOnComma().apply(ImmutableList.of()); }
@Test(expectedExceptions = NullPointerException.class) public void testNullPointer() { new JoinOnComma().apply(null); }