EntityTagResourceDefinition extends BaseResourceDefinition { @Override public String resolveHref(Map<String, Object> properties) { return String.format("v1/entities/%s/tags/%s", properties.get(ENTITY_GUID_PROPERTY), properties.get("name")); } EntityTagResourceDefinition(); @Override String getIdPropertyName(); @Override String getTypeName(); @Override String resolveHref(Map<String, Object> properties); static final String ENTITY_GUID_PROPERTY; }
@Test public void testResolveHref() { Map<String, Object> resourceProps = new HashMap<>(); resourceProps.put("name", "taxonomy1.term1.term11"); resourceProps.put(EntityTagResourceDefinition.ENTITY_GUID_PROPERTY, "11-22-33"); ResourceDefinition entityTagDefinition = new EntityTagResourceDefinition(); String href = entityTagDefinition.resolveHref(resourceProps); assertEquals(href, "v1/entities/11-22-33/tags/taxonomy1.term1.term11"); }