@Test void testGenerator() { final String prefix1 = "http: final String prefix2 = "trellis:data/a/b/c/"; final IdentifierService svc = new DefaultIdentifierService(); final Supplier<String> gen1 = svc.getSupplier(prefix1); final Supplier<String> gen2 = svc.getSupplier(prefix2); final String id1 = gen1.get(); final String id2 = gen2.get(); assertTrue(id1.startsWith(prefix1), WRONG_PREFIX); assertNotEquals(prefix1, id1, "Generated id shouldn't equal prefix!"); assertTrue(id2.startsWith(prefix2), WRONG_PREFIX); assertNotEquals(prefix2, id2, "Generated id shouldn't equal prefix!"); }
@Override public Supplier<String> getSupplier(final String prefix, final int hierarchy, final int length) { requireNonNull(prefix, "The Id prefix may not be null!"); return () -> getId(prefix, hierarchy, length); }
DefaultIdentifierService implements IdentifierService { @Override public Supplier<String> getSupplier(final String prefix, final int hierarchy, final int length) { requireNonNull(prefix, "The Id prefix may not be null!"); return () -> getId(prefix, hierarchy, length); } }
DefaultIdentifierService implements IdentifierService { @Override public Supplier<String> getSupplier(final String prefix, final int hierarchy, final int length) { requireNonNull(prefix, "The Id prefix may not be null!"); return () -> getId(prefix, hierarchy, length); } DefaultIdentifierService();  DefaultIdentifierService(final String prefix); }
DefaultIdentifierService implements IdentifierService { @Override public Supplier<String> getSupplier(final String prefix, final int hierarchy, final int length) { requireNonNull(prefix, "The Id prefix may not be null!"); return () -> getId(prefix, hierarchy, length); } DefaultIdentifierService();  DefaultIdentifierService(final String prefix); @Override Supplier<String> getSupplier(final String prefix, final int hierarchy, final int length); @Override Supplier<String> getSupplier(final String prefix); @Override Supplier<String> getSupplier(); }
DefaultIdentifierService implements IdentifierService { @Override public Supplier<String> getSupplier(final String prefix, final int hierarchy, final int length) { requireNonNull(prefix, "The Id prefix may not be null!"); return () -> getId(prefix, hierarchy, length); } DefaultIdentifierService();  DefaultIdentifierService(final String prefix); @Override Supplier<String> getSupplier(final String prefix, final int hierarchy, final int length); @Override Supplier<String> getSupplier(final String prefix); @Override Supplier<String> getSupplier();  }