@Test void testGenerator2() { final IdentifierService svc = new DefaultIdentifierService(); final Supplier<String> gen = svc.getSupplier("", 4, 2); final String id = gen.get(); final String[] parts = id.split("/"); assertEquals(5L, parts.length, "hierarchical supplier has wrong number of levels!"); assertEquals(parts[0], parts[4].substring(0, 2), "hierarchical supplier has wrong first section!"); assertEquals(parts[1], parts[4].substring(2, 4), "hierarchical supplier has wrong second section!"); assertEquals(parts[2], parts[4].substring(4, 6), "hierarchical supplier has wrong third section!"); assertEquals(parts[3], parts[4].substring(6, 8), "hierarchical supplier has wrong fourth section!"); }
@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();  }