### Question:
View implements NavComposite<View>, HasFocusability, HasVisibility, HasBounds { Registration addListener(ViewListener l) { if (myListeners == null) { myListeners = new Listeners<>(); } final Registration reg = myListeners.add(l); return new Registration() { @Override protected void doRemove() { reg.remove(); if (myListeners.isEmpty()) { myListeners = null; } } }; }  Property<Boolean> visible(); ReadableProperty<Boolean> focused(); Property<Boolean> focusable(); Property<Color> background(); Property<Color> border(); Property<Boolean> hasShadow(); Property<String> name(); @Override final View getParent(); final ReadableProperty<View> parent(); ObservableList<View> children(); void add(View v); void add(int index, View v); void remove(View v); @Override View nextSibling(); @Override View prevSibling(); @Override View firstChild(); @Override View lastChild(); ViewContainer container(); boolean isAttached(); Registration addTrait(final ViewTrait trait); Property<ValueT> getProp(final ViewPropertySpec<ValueT> spec); EventSource<Object> customFeatureChange(final CustomViewFeatureSpec spec); ReadableProperty<Boolean> valid(); void invalidate(); void validate(); ReadableProperty<Rectangle> bounds(); int baseLine(); View viewAt(Vector loc); void moveTo(Vector to); void move(Vector delta); void dispatch(ViewEventSpec<EventT> spec, EventT event); void scrollTo(); void scrollTo(Rectangle rect); EventSource<?> attachEvents(); EventSource<?> detachEvents(); @Override Rectangle getBounds(); @Override String toString(); static final ViewPropertySpec<String> NAME; static final ViewPropertySpec<Boolean> VISIBLE; static final ViewPropertySpec<Boolean> FOCUSED; static final ViewPropertySpec<Boolean> FOCUSABLE; static final ViewPropertySpec<Color> BACKGROUND; static final ViewPropertySpec<Color> BORDER_COLOR; static final ViewPropertySpec<Boolean> HAS_SHADOW; }### Answer:
@Test public void eventsAreFiredInCommands() { ViewContainerListener listener = Mockito.mock(ViewContainerListener.class); container.addListener(listener); container.mousePressed(new MouseEvent(0, 0)); Mockito.verify(listener).onBeforeCommand(); Mockito.verify(listener).onAfterCommand(); }