DiagnosticDataBuilder { public XmlDiagnosticData build() { XmlDiagnosticData diagnosticData = new XmlDiagnosticData(); if (signedDocument != null) { diagnosticData.setDocumentName(removeSpecialCharsForXml(signedDocument.getName())); } diagnosticData.setValidationDate(validationDate); diagnosticData.setContainerInfo(getXmlContainerInfo()); Collection<XmlCertificate> xmlCertificates = buildXmlCertificates(usedCertificates); diagnosticData.getUsedCertificates().addAll(xmlCertificates); linkSigningCertificateAndChains(usedCertificates); Collection<XmlRevocation> xmlRevocations = buildXmlRevocations(usedRevocations); diagnosticData.getUsedRevocations().addAll(xmlRevocations); linkCertificatesAndRevocations(usedCertificates); Collection<XmlSignerData> xmlSignerData = buildXmlSignerDataList(signatures, usedTimestamps); diagnosticData.getOriginalDocuments().addAll(xmlSignerData); if (Utils.isCollectionNotEmpty(signatures)) { Collection<XmlSignature> xmlSignatures = buildXmlSignatures(signatures); diagnosticData.getSignatures().addAll(xmlSignatures); attachCounterSignatures(signatures); } if (Utils.isCollectionNotEmpty(usedTimestamps)) { List<XmlTimestamp> builtTimestamps = buildXmlTimestamps(usedTimestamps); diagnosticData.getUsedTimestamps().addAll(builtTimestamps); linkSignaturesAndTimestamps(signatures); } if (Utils.isMapNotEmpty(xmlOrphanCertificateTokensMap) || Utils.isMapNotEmpty(xmlOrphanRevocationTokensMap)) { diagnosticData.setOrphanTokens(buildXmlOrphanTokens()); } if (Utils.isCollectionNotEmpty(usedTimestamps)) { linkTimestampsAndTimestampsObjects(usedTimestamps); } if (isUseTrustedLists()) { Collection<XmlTrustedList> trustedLists = buildXmlTrustedLists(trustedCertSources); diagnosticData.getTrustedLists().addAll(trustedLists); linkCertificatesAndTrustServices(usedCertificates); } return diagnosticData; }  DiagnosticDataBuilder document(DSSDocument signedDocument); DiagnosticDataBuilder containerInfo(ContainerInfo containerInfo); DiagnosticDataBuilder foundSignatures(List<AdvancedSignature> signatures); DiagnosticDataBuilder usedCertificates(Set<CertificateToken> usedCertificates); DiagnosticDataBuilder certificateSourceTypes(Map<CertificateToken, Set<CertificateSourceType>> certificateSourceTypes); DiagnosticDataBuilder usedRevocations(Set<RevocationToken<Revocation>> usedRevocations); DiagnosticDataBuilder usedTimestamps(Set<TimestampToken> usedTimestamps); DiagnosticDataBuilder tokenExtractionStategy(TokenExtractionStategy tokenExtractionStategy); DiagnosticDataBuilder setDefaultDigestAlgorithm(DigestAlgorithm digestAlgorithm); DiagnosticDataBuilder trustedCertificateSources(ListCertificateSource trustedCertSources); DiagnosticDataBuilder validationDate(Date validationDate); DiagnosticDataBuilder completeCRLSource(ListRevocationSource<CRL> completeCRLSource); DiagnosticDataBuilder completeOCSPSource(ListRevocationSource<OCSP> completeOCSPSource); XmlDiagnosticData build(); boolean isAtLeastOneFound(List<ReferenceValidation> referenceValidations);  }
@Test public void testEmpty() { DiagnosticDataBuilder ddb = new DiagnosticDataBuilder(); XmlDiagnosticData dd = ddb.build(); assertNotNull(dd); }