@Test public void onUnitsFetched_emptyUnitList(){ FetchUnitsEvent mockEmptyListEvent = mock(FetchUnitsEvent.class); ImmutableSet<Unit> unitSet = ImmutableSet.of(); when(mockEmptyListEvent.getUnits()).thenReturn(unitSet); unitListController.onUnitsFetched(mockEmptyListEvent); verify(mockView).setUnits(setUnitsArgument.capture()); assertTrue(setUnitsArgument.getValue().isEmpty()); }
@Override public void onUnitsFetched(FetchUnitsEvent event) { units = new ArrayList<>(event.getUnits()); sortUnits(Unit.Properties.name, true); }
UnitListController extends Controller<UnitListView> implements FetchUnitsEvent.Handler { @Override public void onUnitsFetched(FetchUnitsEvent event) { units = new ArrayList<>(event.getUnits()); sortUnits(Unit.Properties.name, true); } }
UnitListController extends Controller<UnitListView> implements FetchUnitsEvent.Handler { @Override public void onUnitsFetched(FetchUnitsEvent event) { units = new ArrayList<>(event.getUnits()); sortUnits(Unit.Properties.name, true); } UnitListController(UnitListView view); }
UnitListController extends Controller<UnitListView> implements FetchUnitsEvent.Handler { @Override public void onUnitsFetched(FetchUnitsEvent event) { units = new ArrayList<>(event.getUnits()); sortUnits(Unit.Properties.name, true); } UnitListController(UnitListView view); void sortUnits(Unit.Properties property, boolean ascending); void editUnit(Unit unit); @Override void onUnitsFetched(FetchUnitsEvent event); void updateUnits(); @Override void onStop(); }
UnitListController extends Controller<UnitListView> implements FetchUnitsEvent.Handler { @Override public void onUnitsFetched(FetchUnitsEvent event) { units = new ArrayList<>(event.getUnits()); sortUnits(Unit.Properties.name, true); } UnitListController(UnitListView view); void sortUnits(Unit.Properties property, boolean ascending); void editUnit(Unit unit); @Override void onUnitsFetched(FetchUnitsEvent event); void updateUnits(); @Override void onStop();  }