### Question:
AuditEventService extends AbstractWorkspaceAwareResourceService<StructuredEventEntity> { public AuditEventV4Response getAuditEventByWorkspaceId(Long workspaceId, Long auditId) { StructuredEventEntity event = Optional.ofNullable(legacyStructuredEventDBService.findByWorkspaceIdAndId(workspaceId, auditId)) .orElseThrow(notFound("StructuredEvent", auditId)); return converterUtil.convert(event, AuditEventV4Response.class); }  AuditEventV4Response getAuditEvent(Long auditId); AuditEventV4Response getAuditEventByWorkspaceId(Long workspaceId, Long auditId); List<AuditEventV4Response> getAuditEventsByWorkspaceId(Long workspaceId, String resourceType, Long resourceId, String resourceCrn); @Override WorkspaceResourceRepository<StructuredEventEntity, Long> repository();  }### Answer:
@Test public void testGetAuditEventByWorkspaceIdWhenEventExistsAndHasPermissionToReadItThenTheExpectedEventShouldReturn() { AuditEventV4Response expected = mock(AuditEventV4Response.class); StructuredEventEntity repoResult = new StructuredEventEntity(); when(converterUtil.convert(repoResult, AuditEventV4Response.class)).thenReturn(expected); when(legacyStructuredEventDBService.findByWorkspaceIdAndId(TEST_DEFAULT_ORG_ID, TEST_AUDIT_ID)).thenReturn(repoResult); AuditEventV4Response actual = underTest.getAuditEventByWorkspaceId(TEST_DEFAULT_ORG_ID, TEST_AUDIT_ID); Assert.assertEquals(expected, actual); verify(converterUtil, times(1)).convert(repoResult, AuditEventV4Response.class); verify(legacyStructuredEventDBService, times(1)).findByWorkspaceIdAndId(TEST_DEFAULT_ORG_ID, TEST_AUDIT_ID); }