Allow separation of path and certs

Some tests were listed with multiple apparent intermediates in the
documentation, but they were actually one CA to sign the cert and one CA
to sign the CRL. This change allows the fixing of the tests to be able
to assert separate path from general cert collections.

Bug: 8030138
Change-Id: I6dab5be846650c26ed0ed9eb9d8194d93fc85908
diff --git a/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java b/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java
index 5171a64..b3562d3 100644
--- a/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java
+++ b/src/libcore/java/security/cert/X509CertificateNistPkitsTest.java
@@ -152,6 +152,12 @@
 
     private void assertInvalidPath(String trustAnchor, String[] certs, String[] crls)
             throws Exception, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
+        assertInvalidPath(trustAnchor, certs, certs, crls);
+    }
+
+    private void assertInvalidPath(String trustAnchor, String[] path, String[] certs,
+            String[] crls) throws Exception, NoSuchAlgorithmException,
+            InvalidAlgorithmParameterException {
         CertificateFactory f = CertificateFactory.getInstance("X.509");
 
         PKIXParameters params = getTestPathParams(f, trustAnchor, certs, crls);
@@ -169,10 +175,16 @@
     private void assertValidPath(String trustAnchor, String[] certs, String[] crls)
             throws Exception, NoSuchAlgorithmException, CertPathValidatorException,
             InvalidAlgorithmParameterException {
+        assertValidPath(trustAnchor, certs, certs, crls);
+    }
+
+    private void assertValidPath(String trustAnchor, String[] path, String[] certs, String[] crls)
+            throws Exception, NoSuchAlgorithmException, CertPathValidatorException,
+            InvalidAlgorithmParameterException {
         CertificateFactory f = CertificateFactory.getInstance("X.509");
 
         PKIXParameters params = getTestPathParams(f, trustAnchor, certs, crls);
-        CertPath cp = getTestPath(f, certs);
+        CertPath cp = getTestPath(f, path);
         CertPathValidator cpv = CertPathValidator.getInstance("PKIX");
 
         PKIXCertPathValidatorResult cpvResult = (PKIXCertPathValidatorResult) cpv.validate(cp,