Tenant { @JsonIgnore public final boolean isValid() { return Optional.ofNullable(trustedCertificateAuthorities) .map(list -> list.stream().allMatch(TrustedCertificateAuthority::isValid)) .orElse(true); }  @JsonIgnore final boolean isValid(); @JsonIgnore final Tenant setEnabled(final boolean enabled); @JsonIgnore final boolean isEnabled(); final Tenant setExtensions(final Map<String, Object> extensions); final Tenant putExtension(final String key, final Object value); final Map<String, Object> getExtensions(); final Tenant setDefaults(final Map<String, Object> defaults); final Map<String, Object> getDefaults(); final Tenant setAdapters(final List<Adapter> adapters); final List<Adapter> getAdapters(); final Tenant addAdapterConfig(final Adapter configuration); final Integer getMinimumMessageSize(); final Tenant setMinimumMessageSize(final Integer minimumMessageSize); final ResourceLimits getResourceLimits(); final Tenant setResourceLimits(final ResourceLimits resourceLimits); final TenantTracingConfig getTracing(); final Tenant setTracing(final TenantTracingConfig tracing); List<TrustedCertificateAuthority> getTrustedCertificateAuthorities(); Tenant setTrustedCertificateAuthorities(final List<TrustedCertificateAuthority> trustedCertificateAuthorities); @JsonIgnore Set<X500Principal> getTrustedCertificateAuthoritySubjectDNs(); boolean hasTrustedCertificateAuthoritySubjectDN(final X500Principal subjectDn);  }
@Test public void testDecodeTrustedCAUsingCert() throws CertificateException { final JsonObject ca = new JsonObject() .put(RegistryManagementConstants.FIELD_PAYLOAD_CERT, certificate.getEncoded()); final JsonObject tenantJson = new JsonObject() .put(RegistryManagementConstants.FIELD_PAYLOAD_TRUSTED_CA, new JsonArray().add(ca)); final Tenant tenant = tenantJson.mapTo(Tenant.class); assertTrue(tenant.isValid()); }