### Question:
VisibleAspectDefinition extends ModelToUiAspectDefinition<Boolean> { @Override public Aspect<Boolean> createAspect() { switch (visibleType) { case DYNAMIC: return Aspect.of(NAME); case INVISIBLE: return Aspect.of(NAME, false); case VISIBLE: return Aspect.of(NAME, true); default: throw new IllegalStateException("Unknown visible type: " + visibleType); } } VisibleAspectDefinition(VisibleType visibleType); @Override Aspect<Boolean> createAspect(); @Override Consumer<Boolean> createComponentValueSetter(ComponentWrapper componentWrapper); static final String NAME; }### Answer:
@Test public void testCreateAspect_visible() { VisibleAspectDefinition aspectDefinition = new VisibleAspectDefinition(VisibleType.VISIBLE); Aspect<Boolean> createdAspect = aspectDefinition.createAspect(); assertThat(createdAspect.getName(), is(VisibleAspectDefinition.NAME)); assertThat(createdAspect.getValue(), is(true)); }
@Test public void testCreateAspect_dynamic() { VisibleAspectDefinition aspectDefinition = new VisibleAspectDefinition(VisibleType.DYNAMIC); Aspect<Boolean> createdAspect = aspectDefinition.createAspect(); assertThat(createdAspect.getName(), is(VisibleAspectDefinition.NAME)); assertThat(createdAspect.isValuePresent(), is(false)); }