Search in sources :

Example 21 with Response

use of org.doctester.testbrowser.Response in project ninja by ninjaframework.

the class ApplicationControllerTest method testTestModeIndex.

@Test
public void testTestModeIndex() {
    Response response = makeRequest(Request.GET().url(testServerUrl().path("/base/middle/app/mode/test")));
    Assert.assertThat(response.payload, CoreMatchers.equalTo("test mode works."));
}
Also used : Response(org.doctester.testbrowser.Response) Test(org.junit.Test)

Example 22 with Response

use of org.doctester.testbrowser.Response in project ninja by ninjaframework.

the class ApplicationControllerTest method testGet012.

@Test
public void testGet012() {
    Response response = makeRequest(Request.GET().url(testServerUrl().path("/0/1/2/get")));
    Assert.assertThat(response.payload, CoreMatchers.equalTo("get works."));
}
Also used : Response(org.doctester.testbrowser.Response) Test(org.junit.Test)

Example 23 with Response

use of org.doctester.testbrowser.Response in project ninja by ninjaframework.

the class NotFoundTest method testThatNotFoundWorksJson.

@Test
public void testThatNotFoundWorksJson() {
    Response response = makeRequest(Request.GET().url(testServerUrl().path("/_non_existing_url")).addHeader(HttpConstants.HEADER_ACCEPT, HttpConstants.APPLICATION_JSON));
    assertEquals(404, response.httpStatus);
    Message message = response.payloadJsonAs(Message.class);
    Assert.assertThat(message.text, CoreMatchers.equalTo(NinjaConstant.I18N_NINJA_SYSTEM_NOT_FOUND_TEXT_DEFAULT));
}
Also used : Response(org.doctester.testbrowser.Response) Message(ninja.utils.Message) Test(org.junit.Test)

Aggregations

Response (org.doctester.testbrowser.Response)23 Test (org.junit.Test)23 Message (ninja.utils.Message)2 Article (models.Article)1 ArticleDto (models.ArticleDto)1 ArticlesDto (models.ArticlesDto)1