PolicyServiceImpl implements PolicyService { @Override @Transactional public void deletePolicy(String policyId) { assertPolicyId(policyId); try { policyRepository.delete(policyId); } catch (final EmptyResultDataAccessException e) { final StringBuilder errorBuilder = new StringBuilder(); errorBuilder.append( "Policy/PolicySet cannot be found with given ID: ").append( policyId); throw new PolicyNotFoundException(errorBuilder.toString()); } }  @Override @Transactional PolicyMetadataContainerDto addPolicies(
			PolicyContentContainerDto policyContentContainerDto, boolean force); @Override @Transactional void deletePolicy(String policyId); @Override @Transactional(readOnly = true) PolicyMetadataContainerDto getAllPolicyMetadata(); @Override @Transactional(readOnly = true) PolicyContainerDto getPolicies(String policyId, String wildcard); @Override @Transactional(readOnly = true) PolicyDto getPoliciesCombinedAsPolicySet(String policyId,
			String wildcard, String policySetId, String policyCombiningAlgId); @Override Map<String, String> getPolicyCombiningAlgIds(); @Override @Transactional PolicyMetadataDto updatePolicy(
			PolicyContentDto updatePolicyRequestDto, String policyId);  }
@Test public void testDeletePolicy() { final String policyId = "policyId"; sut.deletePolicy(policyId); verify(policyRepository, times(1)).delete(policyId); }
@Test public void testDeletePolicy_Throws_PolicyIdNotFoundException_By_Empty_String() { final String policyId = ""; thrown.expect(PolicyIdNotFoundException.class); sut.deletePolicy(policyId); }
@Test public void testDeletePolicy_Throws_PolicyIdNotFoundException_By_Null() { final String policyId = null; thrown.expect(PolicyIdNotFoundException.class); sut.deletePolicy(policyId); }
@Test public void testDeletePolicy_Throws_PolicyNotFoundException() { final String policyId = "policyId"; doThrow(EmptyResultDataAccessException.class).when(policyRepository) .delete(policyId); thrown.expect(PolicyNotFoundException.class); sut.deletePolicy(policyId); }