RemoteCertificateConverter { public static CertificateToken toCertificateToken(RemoteCertificate remoteCertificate) { if (remoteCertificate == null || Utils.isArrayEmpty(remoteCertificate.getEncodedCertificate())) { return null; } return DSSUtils.loadCertificate(remoteCertificate.getEncodedCertificate()); }  static CertificateToken toCertificateToken(RemoteCertificate remoteCertificate); static RemoteCertificate toRemoteCertificate(CertificateToken certificate); static List<CertificateToken> toCertificateTokens(List<RemoteCertificate> remoteCertificates);  }
@Test public void toCertificateTokenTest() { RemoteCertificate remoteCertificate = new RemoteCertificate(encodedCertificate); CertificateToken certificateToken = RemoteCertificateConverter.toCertificateToken(remoteCertificate); assertTrue(Arrays.equals(remoteCertificate.getEncodedCertificate(), certificateToken.getEncoded())); }