### Question:
DefaultCustomCertificateAccessor implements CustomCertificateAccessor { @Override public void deleteCertificate(String certificateAlias) throws AlertDatabaseConstraintException { if (StringUtils.isBlank(certificateAlias)) { throw new AlertDatabaseConstraintException("The field 'certificateAlias' cannot be blank"); } CustomCertificateEntity customCertificateEntity = customCertificateRepository.findByAlias(certificateAlias) .orElseThrow(() -> new AlertDatabaseConstraintException("A custom certificate with the alias " + certificateAlias + " did not exist")); deleteCertificate(customCertificateEntity.getId()); } @Autowired  DefaultCustomCertificateAccessor(CustomCertificateRepository customCertificateRepository); @Override List<CustomCertificateModel> getCertificates(); @Override Optional<CustomCertificateModel> getCertificate(Long id); @Override CustomCertificateModel storeCertificate(CustomCertificateModel certificateModel); @Override void deleteCertificate(String certificateAlias); @Override void deleteCertificate(Long certificateId);  }### Answer:
@Test public void deleteCertificateByAliasBlankTest() throws Exception { CustomCertificateRepository customCertificateRepository = new MockCustomCertificateRepository(alias, content, testDate); DefaultCustomCertificateAccessor customCertificateAccessor = new DefaultCustomCertificateAccessor(customCertificateRepository); try { customCertificateAccessor.deleteCertificate(""); fail(); } catch (AlertDatabaseConstraintException e) { assertNotNull(e); } }
@Test public void deleteCertificateByIdNullTest() throws Exception { CustomCertificateRepository customCertificateRepository = new MockCustomCertificateRepository(alias, content, testDate); DefaultCustomCertificateAccessor customCertificateAccessor = new DefaultCustomCertificateAccessor(customCertificateRepository); try { Long certificateId = null; customCertificateAccessor.deleteCertificate(certificateId); fail(); } catch (AlertDatabaseConstraintException e) { assertNotNull(e); } try { customCertificateAccessor.deleteCertificate(-1L); fail(); } catch (AlertDatabaseConstraintException e) { assertNotNull(e); } }