EEntity extends TransactionalEntity<EventId, Event, Event.Builder> { static EEntity create(Event event) { Factory factory = new Factory(event); EEntity result = factory.create(); return result; } private  EEntity(EventId id); @SystemColumn(name = CREATED_COLUMN) Timestamp getCreated(); @SystemColumn(name = "type") String getType();  }
@Test @DisplayName("clear enrichments from an event") void clearEnrichments() { Enrichment enrichment = GivenEnrichment.withOneAttribute(); Event event = GivenEvent.arbitrary(); EventContext contextWithEnrichment = event .getContext() .toBuilder() .setEnrichment(enrichment) .build(); Event eventWithEnrichment = event .toBuilder() .setContext(contextWithEnrichment) .build(); EEntity entity = EEntity.create(eventWithEnrichment); assertThat(entity.state()).isEqualTo(event); }