### Question:
ServiceEventDataBuildUpdater implements AuditEventBuilderUpdater<ServiceEventData> { @Override public void update(AuditProto.AuditEvent.Builder auditEventBuilder, ServiceEventData eventData) { AuditProto.ServiceEventData.Builder serviceEventDataBuilder = builderProvider.getNewServiceEventDataBuilder(); doIfTrue(eventData.getEventDetails(), StringUtils::isNotEmpty, serviceEventDataBuilder::setEventDetails); doIfTrue(eventData.getVersion(), StringUtils::isNotEmpty, serviceEventDataBuilder::setDetailsVersion); auditEventBuilder.setServiceEventData(serviceEventDataBuilder.build()); } ServiceEventDataBuildUpdater(ServiceEventDataBuilderProvider builderProvider); @Override void update(AuditProto.AuditEvent.Builder auditEventBuilder, ServiceEventData eventData); @Override Class<ServiceEventData> getType();  }### Answer:
@Test void testUpdateWhenVersionIsNull() { when(mockServiceEventData.getVersion()).thenReturn(null); underTest.update(mockAuditEventBuilder, mockServiceEventData); verify(mockServiceEventDataBuilder, never()).setDetailsVersion(any()); }
@Test void testUpdateWhenVersionIsEmpty() { when(mockServiceEventData.getVersion()).thenReturn(""); underTest.update(mockAuditEventBuilder, mockServiceEventData); verify(mockServiceEventDataBuilder, never()).setDetailsVersion(any()); }
@Test void testUpdateWhenVersionIsNotNull() { String version = "someVersion"; when(mockServiceEventData.getVersion()).thenReturn(version); underTest.update(mockAuditEventBuilder, mockServiceEventData); verify(mockServiceEventDataBuilder, times(1)).setDetailsVersion(any()); verify(mockServiceEventDataBuilder, times(1)).setDetailsVersion(version); }
@Test void testUpdateWhenEventDetailIsNull() { when(mockServiceEventData.getEventDetails()).thenReturn(null); underTest.update(mockAuditEventBuilder, mockServiceEventData); verify(mockServiceEventDataBuilder, never()).setEventDetails(any()); }
@Test void testUpdateWhenEventDetailIsEmpty() { when(mockServiceEventData.getEventDetails()).thenReturn(""); underTest.update(mockAuditEventBuilder, mockServiceEventData); verify(mockServiceEventDataBuilder, never()).setEventDetails(any()); }
@Test void testUpdateWhenEventDetailIsNotNull() { String details = "someDetail"; when(mockServiceEventData.getEventDetails()).thenReturn(details); underTest.update(mockAuditEventBuilder, mockServiceEventData); verify(mockServiceEventDataBuilder, times(1)).setEventDetails(any()); verify(mockServiceEventDataBuilder, times(1)).setEventDetails(details); }