### Question:
JsonWebToken { public String createToken(final Principal principal) { return createToken(principal, null); } JsonWebToken(final SecretKey key);  JsonWebToken(); String createToken(final Principal principal); String createToken(final Principal principal, final List<Permission> permissions); String createToken(final Principal principal, final List<Permission> permissions, final IdentityProvider identityProvider); String createToken(final Map<String, Object> claims); boolean validateToken(final String token); String getSubject(); Date getExpiration(); IdentityProvider getIdentityProvider();  }### Answer:
@Test public void createTokenTest() { Principal user = mock(Principal.class); when(user.getName()).thenReturn("admin"); JsonWebToken jwt = new JsonWebToken(); String token = jwt.createToken(user); Assert.assertNotNull(token); Assert.assertTrue(jwt.validateToken(token)); Assert.assertEquals("admin", jwt.getSubject()); Assert.assertNotNull(jwt.getExpiration()); }