package eu.europa.ec.markt.dss.plugtest;

import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.util.ArrayList;
import java.util.Collection;

import org.apache.commons.io.FileUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import eu.europa.ec.markt.dss.signature.FileDocument;
import eu.europa.ec.markt.dss.validation102853.CommonCertificateVerifier;
import eu.europa.ec.markt.dss.validation102853.SignedDocumentValidator;
import eu.europa.ec.markt.dss.validation102853.report.Reports;

/**
 * This test is only to ensure that we don't have exception with valid? files
 */
@RunWith(Parameterized.class)
public class ETSISamplesValidationTest {

	@Parameters(name = "Validation {index} : {0}")
	public static Collection<Object[]> data() {
		File folder = new File("src/test/resources/plugtest");
		Collection<File> listFiles = FileUtils.listFiles(folder, new String[] { "p7", "p7b", "p7m", "p7s", "asice", "asics", "pdf", "xml", "bdoc",
				"csig", "xsig", "es3" }, true);
		Collection<Object[]> dataToRun = new ArrayList<Object[]>();
		for (File file : listFiles) {
			dataToRun.add(new Object[] { file });
		}
		return dataToRun;
	}

	private File fileToTest;

	public ETSISamplesValidationTest(File fileToTest) {
		this.fileToTest = fileToTest;
	}

	@Test
	public void testValidate() {
		SignedDocumentValidator validator = SignedDocumentValidator.fromDocument(new FileDocument(fileToTest));
		validator.setCertificateVerifier(new CommonCertificateVerifier());
		Reports validateDocument = validator.validateDocument();
		assertNotNull(validateDocument);
	}

}

@@ -603,23 +603,231 @@
 .report.
+DetailedReport;%0Aimport eu.europa.ec.markt.dss.validation102853.report.DiagnosticData;%0Aimport eu.europa.ec.markt.dss.validation102853.report.Reports;%0Aimport eu.europa.ec.markt.dss.validation102853.report.Simple
 Report
-s
 ;%0A%0A/**%0A 
@@ -1797,16 +1797,17 @@
 ier());%0A
+%0A
 %09%09Report
@@ -1891,15 +1891,325 @@
 cument);
+%0A%0A%09%09DiagnosticData diagnosticData = validateDocument.getDiagnosticData();%0A%09%09assertNotNull(diagnosticData);%0A%0A%09%09SimpleReport simpleReport = validateDocument.getSimpleReport();%0A%09%09assertNotNull(simpleReport);%0A%0A%09%09DetailedReport detailedReport = validateDocument.getDetailedReport();%0A%09%09assertNotNull(detailedReport);
 %0A%09%7D%0A%0A%7D%0A

Add some asserts