我正在使用带弹簧安全性的运动衫。 我想用Junit测试我的休息服务,但是存在身份验证问题。 我的项目服务是通过Spring安全保护的,客户端应该通过身份验证。 我想知道是否有办法(或有方法)阻止我的测试或浏览器的操作,以便记住客户端和运行多重测试。
Client client = Client.create();
//I usually write some code here to authenticate client.
WebResource webResource = client.resource("http://localhost:8080/SomeResources");
ClientResponse response = webResource.accept("application/json").get(ClientResponse.class);