DefaultEntityURLFactory extends AbstractGenericEntityURLFactory implements EntityURLFactory { @Override public URL create(Entity entity, Tenant tenant, URLType type) { Preconditions.checkNotNull(entity, "Cannot create URL for a null entity"); try { EntityURLFactory urlFactory = this.componentManager.getInstance(entityURLFactoryOf(entity.getClass()).getType()); if (urlFactory != null) { return urlFactory.create(entity, tenant, type); } } catch (ComponentLookupException e) { } return super.create(entity, tenant, type); }  @Override URL create(Entity entity, Tenant tenant, URLType type);  }
@Test public void testCreateURLWithoutCustomEntityURLFactory() throws Exception { Employee entity = new Employee(UUID.randomUUID(), "john-doe"); URL url = this.componentManager.getComponentUnderTest().create(entity, tenant); Assert.assertEquals("http: }
@Test public void testCreateURLWithCustomEntityURLFactory() throws Exception { SomeEntity entity = new SomeEntity(UUID.randomUUID(), "anything"); URL url = this.componentManager.getComponentUnderTest().create(entity, tenant); Assert.assertEquals("http: }
@Test public void testCreateURLWithPluralFormAnnotation() throws Exception { Todo entity = new Todo(UUID.randomUUID(), "write-more-tests"); URL url = this.componentManager.getComponentUnderTest().create(entity, tenant); Assert.assertEquals("http: }