@Test public void deletePatientTest() { PatientEvent patientDeleteEvent = mock(PatientDeletedEvent.class); doReturn(this.patient).when(patientDeleteEvent).getPatient(); this.eventListener.onEvent(patientDeleteEvent, mock(Object.class), mock(Object.class)); verify(this.patientIndexer).delete(this.patient); }
@Override public void onEvent(final Event event, final Object source, final Object data) { Patient patient = ((PatientEvent) event).getPatient(); if (event instanceof PatientDeletedEvent) { this.indexer.delete(patient); } else if (patient != null) { this.indexer.index(patient); } }
PatientEventListener extends AbstractEventListener { @Override public void onEvent(final Event event, final Object source, final Object data) { Patient patient = ((PatientEvent) event).getPatient(); if (event instanceof PatientDeletedEvent) { this.indexer.delete(patient); } else if (patient != null) { this.indexer.index(patient); } } }
PatientEventListener extends AbstractEventListener { @Override public void onEvent(final Event event, final Object source, final Object data) { Patient patient = ((PatientEvent) event).getPatient(); if (event instanceof PatientDeletedEvent) { this.indexer.delete(patient); } else if (patient != null) { this.indexer.index(patient); } } PatientEventListener(); }
PatientEventListener extends AbstractEventListener { @Override public void onEvent(final Event event, final Object source, final Object data) { Patient patient = ((PatientEvent) event).getPatient(); if (event instanceof PatientDeletedEvent) { this.indexer.delete(patient); } else if (patient != null) { this.indexer.index(patient); } } PatientEventListener(); @Override void onEvent(final Event event, final Object source, final Object data); }
PatientEventListener extends AbstractEventListener { @Override public void onEvent(final Event event, final Object source, final Object data) { Patient patient = ((PatientEvent) event).getPatient(); if (event instanceof PatientDeletedEvent) { this.indexer.delete(patient); } else if (patient != null) { this.indexer.index(patient); } } PatientEventListener(); @Override void onEvent(final Event event, final Object source, final Object data);  }