本文整理汇总了Java中play.mvc.Http.RequestBuilder方法的典型用法代码示例。如果您正苦于以下问题:Java Http.RequestBuilder方法的具体用法?Java Http.RequestBuilder怎么用?Java Http.RequestBuilder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.mvc.Http
的用法示例。
在下文中一共展示了Http.RequestBuilder方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testIndex
import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testIndex() {
Http.RequestBuilder request = new Http.RequestBuilder()
.method(GET)
.uri("/");
Result result = route(app, request);
assertEquals(OK, result.status());
}
示例2: testUnauthenticatedUserRequestingProtectedPage
import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testUnauthenticatedUserRequestingProtectedPage() {
Http.RequestBuilder request = Helpers.fakeRequest()
.method(GET)
.uri(controllers.routes.PostController.getNewPostForm().url());
Result result = route(app, request);
assertThat(result.status()).isEqualTo(UNAUTHORIZED);
}
示例3: testAuthenticatedUserRequestingProtectedPage
import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingProtectedPage() {
Http.RequestBuilder request = Helpers.fakeRequest()
.method(GET)
.session("username", USERNAME)
.uri(controllers.routes.PostController.getNewPostForm().url());
Result result = route(app, request);
assertThat(result.status()).isEqualTo(OK);
}
示例4: testAuthenticatedUserRequestingRegisterPage
import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingRegisterPage() {
Http.RequestBuilder request = Helpers.fakeRequest()
.method(GET)
.session("username", USERNAME)
.uri(controllers.routes.UserController.getRegistrationForm().url());
Result result = route(app, request);
assertThat(result.status()).isEqualTo(SEE_OTHER);
}
示例5: testAuthenticatedUserRequestingToEditHisPost
import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingToEditHisPost() {
PostDTO postDTO = postService.savePost(new PostDTO(null, "TEST", "TEST", null, USERNAME));
Http.RequestBuilder request = Helpers.fakeRequest()
.method(GET)
.session("username", USERNAME)
.uri(controllers.routes.PostController.getEditPostForm(postDTO.id).url());
Result result = route(app, request);
assertThat(result.status()).isEqualTo(OK);
}
示例6: testAuthenticatedUserRequestingToEditPostByOtherUser
import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testAuthenticatedUserRequestingToEditPostByOtherUser() {
UserDTO userDTO = new UserDTO("TEST", "TEST", "[email protected]", "firstName", "lastName");
userService.saveUser(userDTO);
PostDTO postDTO = postService.savePost(new PostDTO(null, "TEST", "TEST", null, userDTO.username));
Http.RequestBuilder request = Helpers.fakeRequest()
.method(GET)
.session("username", USERNAME)
.uri(controllers.routes.PostController.getEditPostForm(postDTO.id).url());
Result result = route(app, request);
assertThat(result.status()).isEqualTo(UNAUTHORIZED);
}
示例7: enviaPOSTAddOpiniao
import play.mvc.Http; //导入方法依赖的package包/类
public static Result enviaPOSTAddOpiniao(JsonNode json, long iniciativaExemplo, String token) {
Logger.debug("Requisição para add opinião: " + json.toString());
Http.RequestBuilder request = new Http.RequestBuilder().method("POST")
.bodyJson(json)
.header("authorization", "token " + token)
.uri(controllers.routes.OpiniaoController.addOpiniao(iniciativaExemplo).url());
return route(request);
}
示例8: testIndex
import play.mvc.Http; //导入方法依赖的package包/类
@Test
public void testIndex() {
Http.RequestBuilder request = new Http.RequestBuilder()
.method(GET)
.uri("/login");
Result result = route(app, request);
assertEquals(OK, result.status());
}