ServerIDFactory { public static String create() { return UUID.randomUUID().toString(); } private  ServerIDFactory(); static String create();  }
@Test public void testCreateMultipleServerIDs() throws Exception { final String sid1 = ServerIDFactory.create(); final String sid2 = ServerIDFactory.create(); final String sid3 = ServerIDFactory.create(); final String sid4 = ServerIDFactory.create(); Assert.assertThat(sid1, not(equalTo(sid2))); Assert.assertThat(sid1, not(equalTo(sid3))); Assert.assertThat(sid1, not(equalTo(sid4))); }
@Test public void testParseAsUUID() throws Exception { final String sid1 = ServerIDFactory.create(); Assert.assertNotNull(UUID.fromString(sid1)); }