### Question:
Signature { public void signMessage() throws CryptoException { try { Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secret); byte[] rawHmac = mac.doFinal(messageToSign.getBytes("UTF-8")); signatureContent = new String(Base64.encodeBase64(rawHmac), "UTF-8"); } catch (NoSuchAlgorithmException | InvalidKeyException e) { throw new CryptoException(e.getCause()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } Signature(final String messageToSign, final SecretKeySpec secret); void signMessage(); SecretKeySpec getSecret(); String getMessageToSign(); String getSignatureContent();  }### Answer:
@Test public void testSignMessage() { String secret = "fsdgrgxgfd"; String message = "message"; SecretKeySpec signingKey = new SecretKeySpec(secret.getBytes(), "HmacSHA1"); Signature signature = new Signature(message, signingKey); signature.signMessage(); assertNotNull(signature.getSignatureContent()); }