@Test public void create_noAuthority_returnsCrnWithNoAuthority() { CrnFactoryImpl crnFactory = new CrnFactoryImpl( ""); assertEquals("crn: }
@Override public String create(String... components) { if (components.length % 2 != 0) { throw new IllegalArgumentException( "Expected an even number of components on the form: type1, id1, type2, id2, etc."); } StringJoiner joiner = new StringJoiner(String.valueOf(SEPARATOR)).add(baseCrn); for (int i = 0; i < components.length; i += 2) { if (components[i + 1] != null) { joiner.add( String.format("%s=%s", trimSeparator(components[i]), trimSeparator(components[i + 1]))); } else { joiner.add(String.format("%s", trimSeparator(components[i]))); } } return joiner.toString(); }
CrnFactoryImpl implements CrnFactory { @Override public String create(String... components) { if (components.length % 2 != 0) { throw new IllegalArgumentException( "Expected an even number of components on the form: type1, id1, type2, id2, etc."); } StringJoiner joiner = new StringJoiner(String.valueOf(SEPARATOR)).add(baseCrn); for (int i = 0; i < components.length; i += 2) { if (components[i + 1] != null) { joiner.add( String.format("%s=%s", trimSeparator(components[i]), trimSeparator(components[i + 1]))); } else { joiner.add(String.format("%s", trimSeparator(components[i]))); } } return joiner.toString(); } }
CrnFactoryImpl implements CrnFactory { @Override public String create(String... components) { if (components.length % 2 != 0) { throw new IllegalArgumentException( "Expected an even number of components on the form: type1, id1, type2, id2, etc."); } StringJoiner joiner = new StringJoiner(String.valueOf(SEPARATOR)).add(baseCrn); for (int i = 0; i < components.length; i += 2) { if (components[i + 1] != null) { joiner.add( String.format("%s=%s", trimSeparator(components[i]), trimSeparator(components[i + 1]))); } else { joiner.add(String.format("%s", trimSeparator(components[i]))); } } return joiner.toString(); } @Inject  CrnFactoryImpl(@CrnAuthorityConfig String crnAuthorityConfig); }
CrnFactoryImpl implements CrnFactory { @Override public String create(String... components) { if (components.length % 2 != 0) { throw new IllegalArgumentException( "Expected an even number of components on the form: type1, id1, type2, id2, etc."); } StringJoiner joiner = new StringJoiner(String.valueOf(SEPARATOR)).add(baseCrn); for (int i = 0; i < components.length; i += 2) { if (components[i + 1] != null) { joiner.add( String.format("%s=%s", trimSeparator(components[i]), trimSeparator(components[i + 1]))); } else { joiner.add(String.format("%s", trimSeparator(components[i]))); } } return joiner.toString(); } @Inject  CrnFactoryImpl(@CrnAuthorityConfig String crnAuthorityConfig); @Override String create(String... components); }
CrnFactoryImpl implements CrnFactory { @Override public String create(String... components) { if (components.length % 2 != 0) { throw new IllegalArgumentException( "Expected an even number of components on the form: type1, id1, type2, id2, etc."); } StringJoiner joiner = new StringJoiner(String.valueOf(SEPARATOR)).add(baseCrn); for (int i = 0; i < components.length; i += 2) { if (components[i + 1] != null) { joiner.add( String.format("%s=%s", trimSeparator(components[i]), trimSeparator(components[i + 1]))); } else { joiner.add(String.format("%s", trimSeparator(components[i]))); } } return joiner.toString(); } @Inject  CrnFactoryImpl(@CrnAuthorityConfig String crnAuthorityConfig); @Override String create(String... components);  }