Search in sources :

Example 31 with Injector

use of com.developmentontheedge.be5.env.Injector 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 32 with Injector

use of com.developmentontheedge.be5.env.Injector 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 33 with Injector

use of com.developmentontheedge.be5.env.Injector 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)

Example 34 with Injector

use of com.developmentontheedge.be5.env.Injector in project be5 by DevelopmentOnTheEdge.

the class MenuTest method testDefaultActionAdmin.

@Test
public void testDefaultActionAdmin() {
    initUserWithRoles(RoleType.ROLE_ADMINISTRATOR, RoleType.ROLE_SYSTEM_DEVELOPER);
    Response response = mock(Response.class);
    component.generate(getMockRequest("defaultAction"), response, injector);
    verify(response).sendAsRawJson(eq(new Action("call", "table/testtableAdmin/All records")));
    initUserWithRoles(RoleType.ROLE_GUEST);
}
Also used : Response(com.developmentontheedge.be5.api.Response) Action(com.developmentontheedge.be5.model.Action) Test(org.junit.Test) Be5ProjectTest(com.developmentontheedge.be5.test.Be5ProjectTest)

Example 35 with Injector

use of com.developmentontheedge.be5.env.Injector in project be5 by DevelopmentOnTheEdge.

the class MenuTest method testUnknownAction.

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

Aggregations

Test (org.junit.Test)23 Be5ProjectTest (com.developmentontheedge.be5.test.Be5ProjectTest)21 Response (com.developmentontheedge.be5.api.Response)20 ResourceData (com.developmentontheedge.be5.model.jsonapi.ResourceData)7 Action (com.developmentontheedge.be5.model.Action)6 ErrorModel (com.developmentontheedge.be5.model.jsonapi.ErrorModel)5 Be5Exception (com.developmentontheedge.be5.api.exceptions.Be5Exception)4 UserAwareMeta (com.developmentontheedge.be5.api.helpers.UserAwareMeta)4 StaticPagePresentation (com.developmentontheedge.be5.model.StaticPagePresentation)4 JsonApiModel (com.developmentontheedge.be5.model.jsonapi.JsonApiModel)4 Request (com.developmentontheedge.be5.api.Request)3 DocumentGenerator (com.developmentontheedge.be5.query.DocumentGenerator)3 Map (java.util.Map)3 UserHelper (com.developmentontheedge.be5.api.helpers.UserHelper)2 Injector (com.developmentontheedge.be5.env.Injector)2 Project (com.developmentontheedge.be5.metadata.model.Project)2 Query (com.developmentontheedge.be5.metadata.model.Query)2 TableModel (com.developmentontheedge.be5.query.impl.model.TableModel)2 SqlMockOperationTest (com.developmentontheedge.be5.test.SqlMockOperationTest)2 HashUrl (com.developmentontheedge.be5.util.HashUrl)2