CertificatePairParser extends Parser<CertificatePair> { @Override public CertificatePair parse() { LOGGER.debug("Parsing CertificatePair"); CertificatePair pair = new CertificatePair(); parseCertificateLength(pair); parseCertificate(pair); parseExtensionsLength(pair); parseExtensions(pair); return pair; } CertificatePairParser(int startposition, byte[] array); @Override CertificatePair parse();  }
@Test public void testParse() { CertificatePairParser parser = new CertificatePairParser(0, certpair); CertificatePair pair = parser.parse(); assertTrue(certificateLength == pair.getCertificateLength().getValue()); assertTrue(extensionsLength == pair.getExtensionsLength().getValue()); assertArrayEquals(certificate, pair.getCertificate().getValue()); assertArrayEquals(extension, pair.getExtensions().getValue()); }