### Question:
JwtSubjectServletCreator implements SubjectCreate { @Override public Subject createSubject(Object context) { String authorization = ((HttpServletRequest)context).getHeader(AUTHORIZATION); if (authorization != null && authorization.startsWith(BEARER)) { String jwtValue = authorization.replace(BEARER, "").trim(); if (JsonWebTokenUtil.isNotJsonWebToken(jwtValue)) { if (logger.isInfoEnabled()) { logger.info("can not create JwtSubject by this request message, is not jwt"); } return null; } String remoteHost = ((HttpServletRequest) context).getRemoteHost(); String requestUri = ((HttpServletRequest) context).getRequestURI(); String requestType = ((HttpServletRequest) context).getMethod(); String targetUri = requestUri.concat("===").concat(requestType.toLowerCase()); String userAgent = SurenessCommonUtil.findUserAgent((HttpServletRequest) context); return JwtSubject.builder(jwtValue) .setRemoteHost(remoteHost) .setTargetResource(targetUri) .setUserAgent(userAgent) .build(); } return null; }  @Override boolean canSupportSubject(Object context); @Override Subject createSubject(Object context);  }### Answer:
@Test public void createSubject() { String jwt = JsonWebTokenUtil.issueJwt(UUID.randomUUID().toString(), "tom", "token-server", 36000L, Arrays.asList("role2", "rol3"), null, Boolean.FALSE, SignatureAlgorithm.HS512); HttpServletRequest request = createNiceMock(HttpServletRequest.class); expect(request.getHeader(AUTHORIZATION)).andReturn(BEARER + " " + jwt); expect(request.getRequestURI()).andReturn("/api/v1/book"); expect(request.getMethod()).andReturn("put"); expect(request.getRemoteHost()).andReturn("192.167.2.1"); replay(request); assertNotNull(creator.createSubject(request)); verify(request); }