ErrorThrowingIdentifierSource implements IdentifierSource { @Override public int calculateId(String name, Set<Integer> usedIds) { throw new UnsupportedOperationException("No identifier provided for value " + name + "; please specify an explicit ID"); }  @Override int calculateId(String name, Set<Integer> usedIds);  }
@Test(expected = UnsupportedOperationException.class) public void shouldThrowExceptionWhenIdentifierRequested() { new ErrorThrowingIdentifierSource().calculateId("foo", Collections.<Integer> emptySet()); }