@Test
public void should_validate_roa() {

    TrustAnchor ta = wtx(tx -> {
        TrustAnchor ta1 = factory.createTrustAnchor(tx, x -> x.roaPrefixes(Collections.singletonList(
                RoaPrefix.of(IpRange.prefix(IpAddress.parse("192.168.0.0"), 16), 24, Asn.parse("64512"),
                        DateTime.now().toInstant().getMillis(),
                        DateTime.now().plusYears(1).toInstant().getMillis(),
                        TrustAnchorsFactory.nextSerial())
        )));
        this.getTrustAnchors().add(tx, ta1);
        final Ref<TrustAnchor> trustAnchorRef = this.getTrustAnchors().makeRef(tx, ta1.key());
        RpkiRepository repository = this.getRpkiRepositories().register(tx, trustAnchorRef, TA_RRDP_NOTIFY_URI, RpkiRepository.Type.RRDP);
        validationScheduler.addRrdpRpkiRepository(repository);
        repository.setDownloaded();
        this.getRpkiRepositories().update(tx, repository);
        return ta1;
    });
    subject.validate(ta.key().asLong());
    List<CertificateTreeValidationRun> completed = rtx(tx -> this.getValidationRuns().findAll(tx, CertificateTreeValidationRun.class));
    assertThat(completed).hasSize(1);
    CertificateTreeValidationRun result = completed.get(0);
    List<Pair<CertificateTreeValidationRun, RpkiObject>> validatedRoas = rtx(tx -> this.getValidationRuns()
            .findCurrentlyValidated(tx, RpkiObject.Type.ROA).collect(toList()));
    assertThat(validatedRoas).hasSize(1);
    assertThat(validatedRoas.get(0).getLeft()).isEqualTo(result);
}