TitleServiceDefault implements TitleService { @Override public String titleOf(final Object domainObject) { if(specificationLoader == null) { return "" + domainObject; } val pojo = unwrapped(domainObject); val objectAdapter = ManagedObject.of(specificationLoader::loadSpecification, pojo); if(EntityUtil.isDestroyed(objectAdapter)) { return "[DELETED]"; } else { return objectAdapter.getSpecification().getTitle(null, objectAdapter); } } @Inject  TitleServiceDefault(WrapperFactory wrapperFactory, SpecificationLoader specificationLoader); @Override String titleOf(final Object domainObject); @Override String iconNameOf(final Object domainObject);  }
@Test void enum_shouldHonorTitleByMethod() { Object domainObject = FeaturedEnum.FIRST; val title = titleService.titleOf(domainObject); assertEquals("first", title); }
@Test void enum_shouldFallbackTitleToEnumName() { Object domainObject = PlainEnum.FIRST; val title = titleService.titleOf(domainObject); assertEquals("First", title); }