### Question:
BaseProcessable extends BaseWorker implements IProcessable { @Override public void importCertificateChain(final List<Certificate> certChain, final String alias, final char[] authenticationCode, Map<String, Object> params, final IServices services) throws CryptoTokenOfflineException, NoSuchAliasException, InvalidAlgorithmParameterException, UnsupportedCryptoTokenParameter, OperationUnsupportedException { try { final ICryptoTokenV4 token = getCryptoToken(services); if (token == null) { throw new CryptoTokenOfflineException("Crypto token offline"); } else { token.importCertificateChain(certChain, alias, authenticationCode, params, services); } } catch (SignServerException e) { log.error(FAILED_TO_GET_CRYPTO_TOKEN_ + e.getMessage()); throw new CryptoTokenOfflineException(e); } } protected  BaseProcessable(); @Override void init(int workerId, WorkerConfig config,
            WorkerContext workerContext, EntityManager workerEM); @Override void activateSigner(String authenticationCode, IServices services); @Override boolean deactivateSigner(IServices services); @Override String getAuthenticationType(); ICryptoTokenV4 getCryptoToken(final IServices services); @Override int getCryptoTokenStatus(IServices services); Certificate getSigningCertificate(ICryptoInstance crypto); Certificate getSigningCertificate(IServices services); Certificate getSigningCertificate(String alias, IServices services); List<Certificate> getSigningCertificateChain(final ICryptoInstance crypto); List<Certificate> getSigningCertificateChain(final IServices services); List<Certificate> getSigningCertificateChain(final String alias, final IServices services); @Override ICertReqData genCertificateRequest(ISignerCertReqInfo certReqInfo, boolean explicitEccParameters, String keyAlias, IServices services); @Override ICertReqData genCertificateRequest(ISignerCertReqInfo certReqInfo, boolean explicitEccParameters, boolean defaultKey, IServices services); @Override ICertReqData genCertificateRequest(ISignerCertReqInfo info,
            final boolean explicitEccParameters, final boolean defaultKey); @Override boolean removeKey(String alias, IServices services); @Override void generateKey(final String keyAlgorithm, final String keySpec, final String alias, final char[] authCode, Map<String, Object> params, final IServices services); @Override Collection<org.signserver.common.KeyTestResult> testKey(String alias, char[] authCode); @Override Collection<org.signserver.common.KeyTestResult> testKey(String alias,
        char[] authCode, IServices services); @Override void importCertificateChain(final List<Certificate> certChain, final String alias, final char[] authenticationCode, Map<String, Object> params, final IServices services); @Override TokenSearchResults searchTokenEntries(int startIndex, int max, final QueryCriteria qc, final boolean includeData, final Map<String, Object> params, final IServices services); @Override List<String> getCertificateIssues(List<Certificate> certificateChain); static final String PROPERTY_CACHE_PRIVATEKEY; }### Answer:
@Test public void testImportCertificateChain() throws Exception { LOG.info("testGetCryptoToken_noDefaults"); Properties globalConfig = new Properties(); WorkerConfig workerConfig = new WorkerConfig(); MockServices services = new MockServices(globalConfig); workerConfig.setProperty(WorkerConfig.IMPLEMENTATION_CLASS, TestSigner.class.getName()); workerConfig.setProperty(WorkerConfig.CRYPTOTOKEN_IMPLEMENTATION_CLASS, MockedCryptoToken.class.getName()); workerConfig.setProperty("NAME", "TestSigner100"); TestSigner instance = new TestSigner(globalConfig); instance.init(workerId, workerConfig, anyContext, null); final List<Certificate> chain = Arrays.asList(CertTools.getCertfromByteArray(Base64.decode(CERT2))); instance.importCertificateChain(chain, "alias2", null, Collections.<String, Object>emptyMap(), services); final List<Certificate> importedChain = instance.getSigningCertificateChain("alias2", null); System.out.println("CERT2: " + chain.get(0).toString()); System.out.println("ACTUAL: " + importedChain.get(0)); assertTrue("Matching certificate", Arrays.equals(chain.get(0).getEncoded(), importedChain.get(0).getEncoded())); }