### Question:
StatusUpdateTrigger extends AbstractEventHandler<InstanceEvent> { protected Mono<Void> updateStatus(InstanceId instanceId) { return this.statusUpdater.updateStatus(instanceId).onErrorResume((e) -> { log.warn("Unexpected error while updating status for {}", instanceId, e); return Mono.empty(); }).doFinally((s) -> this.intervalCheck.markAsChecked(instanceId)); } StatusUpdateTrigger(StatusUpdater statusUpdater, Publisher<InstanceEvent> publisher); @Override void start(); @Override void stop(); void setInterval(Duration updateInterval); void setLifetime(Duration statusLifetime);  }### Answer:
@Test public void should_update_on_instance_registered_event() { this.events.next(new InstanceRegisteredEvent(this.instance.getId(), this.instance.getVersion(), this.instance.getRegistration())); verify(this.updater, times(1)).updateStatus(this.instance.getId()); }
@Test public void should_update_on_instance_registration_update_event() { this.events.next(new InstanceRegistrationUpdatedEvent(this.instance.getId(), this.instance.getVersion(), this.instance.getRegistration())); verify(this.updater, times(1)).updateStatus(this.instance.getId()); }
@Test public void should_not_update_on_non_relevant_event() { this.events.next(new InstanceInfoChangedEvent(this.instance.getId(), this.instance.getVersion(), Info.empty())); verify(this.updater, never()).updateStatus(this.instance.getId()); }
@Test public void should_continue_update_after_error() throws InterruptedException { when(this.updater.updateStatus(any())).thenReturn(Mono.error(IllegalStateException::new)) .thenReturn(Mono.empty()); this.events.next(new InstanceRegistrationUpdatedEvent(this.instance.getId(), this.instance.getVersion(), this.instance.getRegistration())); this.events.next(new InstanceRegistrationUpdatedEvent(this.instance.getId(), this.instance.getVersion(), this.instance.getRegistration())); verify(this.updater, times(2)).updateStatus(this.instance.getId()); }