@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());
}