SessionResource { @GET @Path("/currentUser") public User currentUser(@Auth AccessToken token) { return userDAO.getUserById(token.getUserId()); } SessionResource(AccessTokenDAO accessTokenDAO, UserDAO userDAO, FailedLoginDAO failedLoginDAO, FacebookClient client, AmazonClient s3); @POST @Path("/login") AccessToken login(LoginCredentials credentials); @POST @Path("/logout") void logout(@Auth AccessToken token); @GET @Path("/currentUser") User currentUser(@Auth AccessToken token); @POST @Path("/fbLogin") AccessToken fbLogin(String fbToken);  }
@Test public void testCurrentUser() throws Exception { Response res = rule.getJerseyTest() .target("/session/currentUser") .request().accept(MediaType.APPLICATION_JSON) .header("Authorization", "Bearer test") .get(); @SuppressWarnings("rawtypes") LinkedHashMap read = mapper.readValue(res.readEntity(String.class), LinkedHashMap.class); assertThat(res.getStatusInfo().getStatusCode()).isEqualTo(200); assertThat(read.get("email")).isEqualTo(user.getEmail()); }