Search in sources :

Example 26 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class MainServletTest method runUnknownComponent.

@Test
public void runUnknownComponent() throws Exception {
    String componentId = "foo";
    Request req = mock(Request.class);
    Response res = mock(Response.class);
    spyMainServlet.runComponent(componentId, req, res);
    verify(req).setAttribute("testRequestPreprocessor", "testProject");
    verify(res).sendError(eq(Be5Exception.unknownComponent("foo")));
}
Also used : Response(com.developmentontheedge.be5.api.Response) HttpServletResponse(javax.servlet.http.HttpServletResponse) HttpServletRequest(javax.servlet.http.HttpServletRequest) Request(com.developmentontheedge.be5.api.Request) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest) Test(org.junit.Test)

Example 27 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class LanguageSelectorTest method generateSelect.

@Test
public void generateSelect() throws Exception {
    Response response = mock(Response.class);
    Request request = getSpyMockRequest("select", ImmutableMap.of("language", "RU"));
    component.generate(request, response, injector);
    verify(response).sendAsRawJson(eq(languageSelectorResponse));
}
Also used : Response(com.developmentontheedge.be5.api.Response) Request(com.developmentontheedge.be5.api.Request) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 28 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class LanguageSelectorTest method generate.

@Test
public void generate() throws Exception {
    Response response = mock(Response.class);
    component.generate(getMockRequest(""), response, injector);
    verify(response).sendAsRawJson(eq(languageSelectorResponse));
}
Also used : Response(com.developmentontheedge.be5.api.Response) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 29 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class LanguageSelectorTest method generateLanguageParameterIsAbsent.

@Test
public void generateLanguageParameterIsAbsent() throws Exception {
    expectedEx.expect(Be5Exception.class);
    expectedEx.expectMessage(ErrorTitles.formatTitle(Be5ErrorCode.PARAMETER_ABSENT, "language"));
    Response response = mock(Response.class);
    component.generate(getSpyMockRequest("select"), response, injector);
}
Also used : Response(com.developmentontheedge.be5.api.Response) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 30 with Response

use of com.developmentontheedge.be5.api.Response in project be5 by DevelopmentOnTheEdge.

the class MenuTest method testWithIds.

@Test
public void testWithIds() {
    Response response = mock(Response.class);
    component.generate(getMockRequest("withIds"), response, injector);
    verify(response).sendAsRawJson(isA(Menu.MenuResponse.class));
}
Also used : Response(com.developmentontheedge.be5.api.Response) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Aggregations

Response (com.developmentontheedge.be5.api.Response)23 Test (org.junit.Test)22 Be5ProjectTest (com.developmentontheedge.be5.test.Be5ProjectTest)20 Request (com.developmentontheedge.be5.api.Request)6 Be5Exception (com.developmentontheedge.be5.api.exceptions.Be5Exception)5 ErrorModel (com.developmentontheedge.be5.model.jsonapi.ErrorModel)5 ResourceData (com.developmentontheedge.be5.model.jsonapi.ResourceData)5 HttpServletResponse (javax.servlet.http.HttpServletResponse)5 Action (com.developmentontheedge.be5.model.Action)4 JsonApiModel (com.developmentontheedge.be5.model.jsonapi.JsonApiModel)3 Map (java.util.Map)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 UserAwareMeta (com.developmentontheedge.be5.api.helpers.UserAwareMeta)2 UserHelper (com.developmentontheedge.be5.api.helpers.UserHelper)2 ResponseImpl (com.developmentontheedge.be5.api.impl.ResponseImpl)2 DocumentGenerator (com.developmentontheedge.be5.query.DocumentGenerator)2 SqlMockOperationTest (com.developmentontheedge.be5.test.SqlMockOperationTest)2 HashUrl (com.developmentontheedge.be5.util.HashUrl)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Date (java.util.Date)2