TermResourceDefinition extends BaseResourceDefinition { @Override public String resolveHref(Map<String, Object> properties) { StringBuilder sb = new StringBuilder(); sb.append("v1/taxonomies/"); TermPath termPath = new TermPath(String.valueOf(properties.get("name"))); String[] paths = termPath.getPathSegments(); sb.append(termPath.getTaxonomyName()); for (String path : paths) { if (path != null && !path.isEmpty()) { sb.append("/terms/"); sb.append(path); } } return sb.toString(); } TermResourceDefinition(); @Override void validateCreatePayload(Request request); @Override String getTypeName(); @Override String getIdPropertyName(); @Override String resolveHref(Map<String, Object> properties);  }
@Test public void testResolveHref() { Map<String, Object> resourceProps = new HashMap<>(); resourceProps.put("name", "taxonomy1.term1.term11"); ResourceDefinition termDefinition = new TermResourceDefinition(); String href = termDefinition.resolveHref(resourceProps); assertEquals(href, "v1/taxonomies/taxonomy1/terms/term1/terms/term11"); }