CollectionUtil { public static String key(Object key) { if (key == null) { throw new IllegalArgumentException(); } else if (key instanceof String) { return ((String) key); } else { return (key.toString()); } } private  CollectionUtil(); static String key(Object key); static int enumerationSize(Enumeration<?> keys);  }
@Test public void testKey() { assertEquals("1", CollectionUtil.key(1)); assertEquals("hello", CollectionUtil.key("hello")); }
@Test(expected = IllegalArgumentException.class) public void testKeyException() { CollectionUtil.key(null); }