@Test
public void should_report_proper_error_when_repository_is_unavailable() {

    TrustAnchor trustAnchor = wtx(tx -> {
        TrustAnchor ta = factory.createTypicalTa(tx, KEY_PAIR_FACTORY.generate());
        this.getTrustAnchors().add(tx, ta);
        return ta;
    });
    RpkiRepository repository = wtx(tx -> {
        final Ref<TrustAnchor> trustAnchorRef = this.getTrustAnchors().makeRef(tx, trustAnchor.key());
        RpkiRepository r = this.getRpkiRepositories().register(tx, trustAnchorRef, TA_RRDP_NOTIFY_URI, RpkiRepository.Type.RRDP);
        r.setFailed();
        this.getRpkiRepositories().update(tx, r);
        final URI manifestUri = trustAnchor.getCertificate().getManifestUri();
        final Optional<RpkiObject> mft = this.getRpkiObjects().values(tx)
                .stream()
                .filter(o -> this.getRpkiObjects().getLocations(tx, o.key()).contains(manifestUri.toASCIIString()))
                .findFirst();
        mft.ifPresent(m -> this.getRpkiObjects().delete(tx, m));
        return r;
    });
    subject.validate(trustAnchor.key().asLong());
    rtx0(tx -> {
        List<CertificateTreeValidationRun> completed = this.getValidationRuns().findAll(tx, CertificateTreeValidationRun.class);
        assertThat(completed).hasSize(1);
        final List<net.ripe.rpki.validator3.storage.data.validation.ValidationCheck> checks = completed.get(0).getValidationChecks();
        assertThat(checks.get(0).getKey()).isEqualTo(ValidationString.VALIDATOR_NO_MANIFEST_REPOSITORY_FAILED);
        assertThat(checks.get(0).getParameters()).isEqualTo(Collections.singletonList(repository.getRrdpNotifyUri()));
    });
}