### Question:
ZeusUtils { public static X509CertificateHolder parseCert(String certIn, List<ErrorEntry> errors) { X509CertificateHolder x509obj = null; List<PemBlock> blocks = PemUtils.parseMultiPem(certIn); Object obj; if (blocks.size() < 1) { errors.add(new ErrorEntry(ErrorType.UNREADABLE_CERT, CERTREQUIRED, true, null)); return x509obj; } if (blocks.size() > 1) { errors.add(new ErrorEntry(ErrorType.UNREADABLE_CERT, "userCrt contains more then one pem block", true, null)); return x509obj; } obj = blocks.get(0).getDecodedObject(); if ((obj == null) || !(obj instanceof X509CertificateHolder)) { String msg = String.format("%s Certificate decoded to class %s but was expecting %s", ERRORDECODINGCERT, obj.getClass().getName(), X509CertificateHolder.class.getCanonicalName()); errors.add(new ErrorEntry(ErrorType.UNREADABLE_CERT, msg, true, null)); return x509obj; } x509obj = (X509CertificateHolder) obj; return x509obj; } 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 shouldValidateWellFormedCertificate() { List<ErrorEntry> errors = new ArrayList<ErrorEntry>(); ZeusUtils.parseCert(workingUserCrt, errors); Assert.assertTrue(errors.isEmpty()); }
@Test public void shouldInvalidateMalformedCertificate() { List<ErrorEntry> errors = new ArrayList<ErrorEntry>(); ZeusUtils.parseCert("foobar", errors); Assert.assertFalse(errors.isEmpty()); Assert.assertEquals(ErrorType.UNREADABLE_CERT, errors.get(0).getErrorType()); }