SearchId { public String next() { return String.format("%s-%d-%d", prefix, sequence.incrementAndGet(), new Date().getTime()); } SearchId(String prefix); String next();  }
@Test public void testNext() { String prefix = "xyz"; SearchId id = new SearchId(prefix); assertThat(id.next().contains(prefix)); assertThat(id.next()).isNotEqualTo(id.next()); }