### Question:
AssuranceServiceImpl implements AssuranceService { @Override public Response deleteById(UUID assuranceId, HttpHeaders headers) { assuranceRepository.deleteById(assuranceId); Assurance a = assuranceRepository.findById(assuranceId); if (a == null) { AssuranceServiceImpl.LOGGER.info("[Assurance-Add&Delete-Service][DeleteAssurance] Success."); return new Response<>(1, "Delete Success with Assurance id", null); } else { AssuranceServiceImpl.LOGGER.info("[Assurance-Add&Delete-Service][DeleteAssurance] Fail.Assurance not clear."); return new Response<>(0, "Fail.Assurance not clear", assuranceId); } }  @Override Response findAssuranceById(UUID id, HttpHeaders headers); @Override Response findAssuranceByOrderId(UUID orderId, HttpHeaders headers); @Override Response create(int typeIndex, String orderId, HttpHeaders headers); @Override Response deleteById(UUID assuranceId, HttpHeaders headers); @Override Response deleteByOrderId(UUID orderId, HttpHeaders headers); @Override Response modify(String assuranceId, String orderId, int typeIndex, HttpHeaders headers); @Override Response getAllAssurances(HttpHeaders headers); @Override Response getAllAssuranceTypes(HttpHeaders headers);  }### Answer:
@Test public void testDeleteById1() { UUID assuranceId = UUID.randomUUID(); Mockito.doNothing().doThrow(new RuntimeException()).when(assuranceRepository).deleteById(assuranceId); Mockito.when(assuranceRepository.findById(assuranceId)).thenReturn(null); Response result = assuranceServiceImpl.deleteById(assuranceId, headers); Assert.assertEquals(new Response<>(1, "Delete Success with Assurance id", null), result); }
@Test public void testDeleteById2() { UUID assuranceId = UUID.randomUUID(); Mockito.doNothing().doThrow(new RuntimeException()).when(assuranceRepository).deleteById(assuranceId); Assurance assurance = new Assurance(); Mockito.when(assuranceRepository.findById(assuranceId)).thenReturn(assurance); Response result = assuranceServiceImpl.deleteById(assuranceId, headers); Assert.assertEquals(new Response<>(0, "Fail.Assurance not clear", assuranceId), result); }