use of com.developmentontheedge.be5.env.Injector in project be5 by DevelopmentOnTheEdge.
the class MenuTest method testDefaultAction.
@Test
public void testDefaultAction() {
Response response = mock(Response.class);
component.generate(getMockRequest("defaultAction"), response, injector);
verify(response).sendAsRawJson(eq(new Action("call", "table/testtable/All records")));
}
use of com.developmentontheedge.be5.env.Injector in project be5 by DevelopmentOnTheEdge.
the class MenuTest method testDefaultActionUser.
@Test
public void testDefaultActionUser() {
initUserWithRoles("User");
Response response = mock(Response.class);
component.generate(getMockRequest("defaultAction"), response, injector);
verify(response).sendAsRawJson(eq(new Action("call", "table/testtUser/testtUser")));
initUserWithRoles(RoleType.ROLE_GUEST);
}
use of com.developmentontheedge.be5.env.Injector in project be5 by DevelopmentOnTheEdge.
the class QueryBuilderTest method generate.
@Test
public void generate() {
Response response = mock(Response.class);
component.generate(getSpyMockRequest("queryBuilder", ImmutableMap.of("sql", "select * from testtable limit 1", RestApiConstants.TIMESTAMP_PARAM, "" + new Date().getTime())), response, injector);
verify(response).sendAsJson(any(JsonApiModel.class));
}
use of com.developmentontheedge.be5.env.Injector in project be5 by DevelopmentOnTheEdge.
the class StaticPageComponentTest method generateFoo.
@Test
public void generateFoo() throws Exception {
Response response = mock(Response.class);
String page = "foo.be";
component.generate(getMockRequest(page), response, injector);
verify(response).sendErrorAsJson(any(ErrorModel.class), any(Map.class));
}
use of com.developmentontheedge.be5.env.Injector in project be5 by DevelopmentOnTheEdge.
the class UserInfoComponentTest method generateSelectRolesAndSendNewStateNotAvailableRole.
@Test
public void generateSelectRolesAndSendNewStateNotAvailableRole() throws Exception {
Response response = mock(Response.class);
component.generate(getSpyMockRequest("", ImmutableMap.of("roles", RoleType.ROLE_ADMINISTRATOR)), response, injector);
verify(response).sendAsRawJson(new UserInfoComponent.State(true, TEST_USER, Collections.singletonList(RoleType.ROLE_ADMINISTRATOR), Collections.singletonList(RoleType.ROLE_ADMINISTRATOR), any(Date.class)));
}
Aggregations