### Question:
EnabledAspectDefinition extends ModelToUiAspectDefinition<Boolean> { @Override public Aspect<Boolean> createAspect() { switch (enabledType) { case DISABLED: return Aspect.of(NAME, false); case DYNAMIC: return Aspect.of(NAME); case ENABLED: return Aspect.of(NAME, true); default: throw new IllegalStateException("Unknown enabled type: " + enabledType); } } EnabledAspectDefinition(EnabledType enabledType); @Override Aspect<Boolean> createAspect(); @Override Consumer<Boolean> createComponentValueSetter(ComponentWrapper componentWrapper); static final String NAME; }### Answer:
@Test public void testCreateAspect_enabled() { EnabledAspectDefinition aspectDefinition = new EnabledAspectDefinition(EnabledType.ENABLED); Aspect<Boolean> createdAspect = aspectDefinition.createAspect(); assertThat(createdAspect.getName(), is(EnabledAspectDefinition.NAME)); assertThat(createdAspect.getValue(), is(true)); }
@Test public void testCreateAspect_dynamic() { EnabledAspectDefinition aspectDefinition = new EnabledAspectDefinition(EnabledType.DYNAMIC); Aspect<Boolean> createdAspect = aspectDefinition.createAspect(); assertThat(createdAspect.getName(), is(EnabledAspectDefinition.NAME)); assertThat(createdAspect.isValuePresent(), is(false)); }