### Question:
JwtTool { public String createRefreshToken(User user) { Claims claims = Jwts.claims().setSubject(user.getEmail()); claims.put(AUTHORITIES, Collections.singleton(user.getRole().name())); Date now = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(now); calendar.add(Calendar.MINUTE, refreshTokenValidTimeInMinutes); return Jwts.builder() .setClaims(claims) .setIssuedAt(now) .setExpiration(calendar.getTime()) .signWith(SignatureAlgorithm.HS256, user.getRefreshTokenKey()) .compact(); } @Autowired  JwtTool(@Value("${accessTokenValidTimeInMinutes}") Integer accessTokenValidTimeInMinutes,
                   @Value("${refreshTokenValidTimeInMinutes}") Integer refreshTokenValidTimeInMinutes,
                   @Value("${tokenKey}") String accessTokenKey); String createAccessToken(String email, ROLE role); String createRefreshToken(User user); String getEmailOutOfAccessToken(String token); boolean isTokenValid(String token, String tokenKey); String getAccessTokenKey(); String getTokenFromHttpServletRequest(HttpServletRequest servletRequest); String generateTokenKey();  }### Answer:
@Test public void createRefreshToken() { String s = "secret-refresh-token-key"; User user = new User(); user.setEmail(expectedEmail); user.setRole(expectedRole); user.setRefreshTokenKey(s); String refreshToken = jwtTool.createRefreshToken(user); String actualEmail = Jwts.parser() .setSigningKey(user.getRefreshTokenKey()) .parseClaimsJws(refreshToken) .getBody() .getSubject(); assertEquals(expectedEmail, actualEmail); @SuppressWarnings({"unchecked, rawtype"}) List<String> authorities = (List<String>) Jwts.parser() .setSigningKey(user.getRefreshTokenKey()) .parseClaimsJws(refreshToken) .getBody() .get(AUTHORITIES); assertEquals(expectedRole, ROLE.valueOf(authorities.get(0))); }