PlainIdGenerator implements IdGenerator { @Override public String create(Object msg) { byte[] bytes = new byte[8]; random.nextBytes(bytes); return Conversion.byteArrayToBase64String(bytes).replaceAll("=", "") + getSeparator() + (msg == null ? "0" : Integer.toHexString(msg.hashCode())) + getSeparator() + System.currentTimeMillis(); } PlainIdGenerator();  PlainIdGenerator(String separator); @Override String create(Object msg); String getSeparator(); void setSeparator(String s);  }
@Test public void testCreateId() throws Exception { IdGenerator guid = new PlainIdGenerator(); assertNotNull(guid.create(guid)); }
@Test public void testCreateIdWithNull() throws Exception { IdGenerator guid = new PlainIdGenerator(); assertNotNull(guid.create(null)); }