### Question:
PushEndpoint { @POST @Consumes(MediaType.APPLICATION_JSON) public Response register(@Context Session session,EncryptedEntity.Reader entity){ try{ Credentials credentials = session.getUser(); entity.setKey(keyManager.getPrivateKey()); credentials.setPushMessagingKey(entity.get("token")); dao.save(credentials); } catch (DAOException e) { logger.severe(ExceptionUtils.getStackTrace(e)); return fromDAOExpection(e); } catch (Exception e) { logger.severe(ExceptionUtils.getStackTrace(e)); return Response.serverError().entity("Shit").build(); } return Response.ok().build(); }  @POST @Consumes(MediaType.APPLICATION_JSON) Response register(@Context Session session,EncryptedEntity.Reader entity); @DELETE Response unregister(@Context Session session); @GET @Path("/test/{email}/{data}") @Produces(MediaType.TEXT_HTML) Response pushToDevice(@PathParam("email")String userId, @PathParam("data")String data);  }### Answer:
@Test public void testRegister() throws Exception { Credentials user = AuthenticationEndpointTest.signUpUser(this); PublicKey key = AuthenticationEndpointTest.getPublicKey(this); registerToken(user,key,this); Collection<TransientObject> list = container.serverDao.query(new QueryBuilder().select().from(Credentials.class).build()); TransientObject o = ObjectUtils.get1stOrNull(list); user = TestUtils.convert(o,Credentials.class); assertNotNull(user); assertEquals("whatwhat", user.getPushMessagingKey()); }