### Question:
ZeusUtils { public static Set<X509CertificateHolder> parseIntermediateCerts(String intermediates, List<ErrorEntry> errors) { ResponseWithExcpetions<Set<X509CertificateHolder>> resp = X509ReaderWriter.readSet(intermediates); Set<X509CertificateHolder> intermediateCerts = resp.getReturnObject(); for (Throwable th : resp.getExceptions()) { errors.add(new ErrorEntry(ErrorType.UNREADABLE_CERT, th.getMessage(), false, th)); } return intermediateCerts; } ZeusUtils();  ZeusUtils(Set<X509CertificateHolder> roots); ZeusCrtFile buildZeusCrtFileLbassValidation(String userKeyStr, String userCrtStr, String intermediates); Set<X509CertificateHolder> getRoots(); void setRoots(Set<X509CertificateHolder> roots); static KeyPair parseKey(String keyIn, List<ErrorEntry> errors); static X509CertificateHolder parseCert(String certIn, List<ErrorEntry> errors); static Set<X509CertificateHolder> parseIntermediateCerts(String intermediates, List<ErrorEntry> errors); static List<X509CertificateHolder> decodeImd(Map<X509CertificateHolder, Integer> lineMap, String imdStr, ZeusCrtFile zcf);  }### Answer:
@Test public void shouldValidateWellFormedIntermediateCertificates() { List<ErrorEntry> errors = new ArrayList<ErrorEntry>(); ZeusUtils.parseIntermediateCerts(workingUserChain, errors); Assert.assertTrue(errors.isEmpty()); }
@Test public void shouldInvalidateMalformedIntermediateCertificates() { String foobar = "-----BEGIN CERTIFICATE-----\n" + "foobar\n" + "-----END CERTIFICATE-----\n"; List<ErrorEntry> errors = new ArrayList<ErrorEntry>(); ZeusUtils.parseIntermediateCerts(foobar, errors); Assert.assertFalse(errors.isEmpty()); Assert.assertEquals(ErrorType.UNREADABLE_CERT, errors.get(0).getErrorType()); }