### Question:
EntityViewUpdater { <K extends Entity.Key<S>, S extends Specification> Entity<K, S> update(Event<K, S> event) { if (event instanceof SpecificationEvent) { return update((SpecificationEvent<K, S>) event); } else if (event instanceof StatusEvent) { return update((StatusEvent<K, S>) event); } else if (event instanceof SpecificationDeletionEvent) { return delete((SpecificationDeletionEvent<K, S>) event); } else if (event instanceof StatusDeletionEvent) { return delete((StatusDeletionEvent<K, S>) event); } else { throw new IllegalArgumentException("Unknown event " + event); } }    }### Answer:
@Test public void newSpecification() { var result = underTest.update(specificationEvent); assertThat(result, is(nullValue())); assertThat(entities.get(key), is(entity.withStatus(oldStatus))); }
@Test public void updateSpecification() { entities.put(key, oldEntity); var result = underTest.update(specificationEvent); assertThat(result, is(oldEntity)); assertThat(entities.get(key), is(entity.withStatus(oldStatus))); }
@Test public void newStatusExistingEntity() { entities.put(key, oldEntity); var result = underTest.update(statusEvent); assertThat(result, is(oldEntity)); assertThat(entities.get(key), is(oldEntity.withStatus(status))); }
@Test public void statusNoEntity() { var result = underTest.update(statusEvent); assertThat(result, is(nullValue())); assertThat(entities.get(key), is(nullValue())); }