### Question:
TokenService { public void deactivateToken(String id) throws TokenNotFoundException, ActionNotPossibleException { TokenInfo tokenInfo = getToken(id); auditDataHelper.put(tokenInfo); possibleActionsRuleEngine.requirePossibleTokenAction(PossibleActionEnum.TOKEN_DEACTIVATE, tokenInfo); try { signerProxyFacade.deactivateToken(id); } catch (CodedException e) { if (isCausedByTokenNotFound(e)) { throw new TokenNotFoundException(e); } else { throw e; } } catch (Exception other) { throw new SignerNotReachableException("token deactivation failed", other); } } @Autowired  TokenService(SignerProxyFacade signerProxyFacade,
            PossibleActionsRuleEngine possibleActionsRuleEngine,
            AuditDataHelper auditDataHelper); List<TokenInfo> getAllTokens(); List<CertificateInfo> getSignCertificates(ClientType clientType); List<CertificateInfo> getAllCertificates(ClientType clientType); void activateToken(String id, char[] password); void deactivateToken(String id); TokenInfo getToken(String id); TokenInfo updateTokenFriendlyName(String tokenId, String friendlyName); TokenInfo getTokenForKeyId(String keyId); TokenInfoAndKeyId getTokenAndKeyIdForCertificateHash(String hash); boolean isSoftwareTokenInitialized(); TokenInitStatusInfo getSoftwareTokenInitStatus(); TokenInfoAndKeyId getTokenAndKeyIdForCertificateRequestId(String csrId); boolean hasHardwareTokens();  }### Answer:
@Test public void deactivateToken() throws Exception { tokenService.deactivateToken("token-should-be-deactivatable"); try { tokenService.deactivateToken(TOKEN_NOT_FOUND_TOKEN_ID); fail("should have thrown exception"); } catch (TokenNotFoundException expected) { } try { tokenService.deactivateToken(UNRECOGNIZED_FAULT_CODE_TOKEN_ID); fail("should have thrown exception"); } catch (CodedException expected) { assertEquals("foo", expected.getFaultCode()); assertEquals("bar", expected.getFaultString()); } }