CurrentBrandImpl implements CurrentBrand, HasHandlers { @Override public void update(Brand brand) { if (this.brand == brand) { return; } this.brand = brand; BrandChangedEvent.fire(this.brand, this); } @Inject  CurrentBrandImpl(
            EventBus eventBus); @Override void update(Brand brand); @Override Brand get(); @Override void fireEvent(GwtEvent<?> event);  }
@Test public void updateBrand_firesEventWhenBrandUpdates() { Brand brand = Brand.CHOSEN; currentBrand.update(brand); ArgumentCaptor<BrandChangedEvent> captor = ArgumentCaptor.forClass(BrandChangedEvent.class); verify(eventBus).fireEventFromSource(captor.capture(), same(currentBrand)); assertThat(captor.getValue().getBrand()).isEqualTo(brand); }
@Test public void updateBrand_doesNotFireEventWhenBrandIsSame() { Brand brand = Brand.CHOSEN; currentBrand.update(brand); Mockito.reset(eventBus); currentBrand.update(brand); verifyZeroInteractions(eventBus); }