@Test public void testSelectClient() throws Exception { assertNull(model.getSelectedClient()); model.selectClient(client1); assertEquals(client1, model.getSelectedClient()); assertEquals(1, events.size()); assertTrue(events.get(0) instanceof SelectedClientChangedEvent); assertNull(((SelectedClientChangedEvent) events.get(0)).getOldClient()); assertEquals(client1, ((SelectedClientChangedEvent) events.get(0)).getNewClient()); events.clear(); model.selectClient(client1); assertEquals(client1, model.getSelectedClient()); assertEquals(0, events.size()); events.clear(); model.selectClient(client2); assertEquals(client2, model.getSelectedClient()); assertEquals(1, events.size()); assertTrue(events.get(0) instanceof SelectedClientChangedEvent); assertEquals(client1, ((SelectedClientChangedEvent) events.get(0)).getOldClient()); assertEquals(client2, ((SelectedClientChangedEvent) events.get(0)).getNewClient()); events.clear(); model.selectClient(null); assertNull(model.getSelectedClient()); assertEquals(1, events.size()); assertTrue(events.get(0) instanceof SelectedClientChangedEvent); assertEquals(client2, ((SelectedClientChangedEvent) events.get(0)).getOldClient()); assertNull(((SelectedClientChangedEvent) events.get(0)).getNewClient()); events.clear(); model.selectClient(null); assertNull(model.getSelectedClient()); assertEquals(0, events.size()); events.clear(); }
public void selectClient(Client newClient) { Client oldClient = this.selectedClient; this.selectedClient = newClient; if (!Objects.equals(oldClient, newClient)) { bus.publish(new SelectedClientChangedEvent(oldClient, newClient)); } }
ClientModel { public void selectClient(Client newClient) { Client oldClient = this.selectedClient; this.selectedClient = newClient; if (!Objects.equals(oldClient, newClient)) { bus.publish(new SelectedClientChangedEvent(oldClient, newClient)); } } }
ClientModel { public void selectClient(Client newClient) { Client oldClient = this.selectedClient; this.selectedClient = newClient; if (!Objects.equals(oldClient, newClient)) { bus.publish(new SelectedClientChangedEvent(oldClient, newClient)); } } ClientModel(ClientManager clientManager, TaskManager taskManager); }
ClientModel { public void selectClient(Client newClient) { Client oldClient = this.selectedClient; this.selectedClient = newClient; if (!Objects.equals(oldClient, newClient)) { bus.publish(new SelectedClientChangedEvent(oldClient, newClient)); } } ClientModel(ClientManager clientManager, TaskManager taskManager); void subscribe(Object listener); void unsubscribe(Object listener); Client getSelectedClient(); void selectClient(Client newClient); Client create(); int count(); Client get(int index); int indexOf(Client client); void save(Client client); void delete(Client client); int getTotalSecondsElapsed(Client client); String getTotalTimeElapsed(Client client); BigDecimal getTotalAmountEarned(Client client); String getTotalAmountEarned(Client client, Locale locale); }
ClientModel { public void selectClient(Client newClient) { Client oldClient = this.selectedClient; this.selectedClient = newClient; if (!Objects.equals(oldClient, newClient)) { bus.publish(new SelectedClientChangedEvent(oldClient, newClient)); } } ClientModel(ClientManager clientManager, TaskManager taskManager); void subscribe(Object listener); void unsubscribe(Object listener); Client getSelectedClient(); void selectClient(Client newClient); Client create(); int count(); Client get(int index); int indexOf(Client client); void save(Client client); void delete(Client client); int getTotalSecondsElapsed(Client client); String getTotalTimeElapsed(Client client); BigDecimal getTotalAmountEarned(Client client); String getTotalAmountEarned(Client client, Locale locale);  }