use of org.alfresco.rest.framework.tests.api.mocks.Sheep in project alfresco-remote-api by Alfresco.
the class SerializeTests method testSerializePagedCollection.
@SuppressWarnings({ "rawtypes" })
@Test
public void testSerializePagedCollection() throws IOException {
assertNotNull(helper);
CollectionWithPagingInfo paged = CollectionWithPagingInfo.asPaged(null, null);
String out = writeResponse(helper.processAdditionsToTheResponse(mock(WebScriptResponse.class), api, null, Params.valueOf("notUsed", null, null), paged));
assertTrue("There must be json output as List with pagination", StringUtils.startsWith(out, "{\"list\":{\"pagination\":{\"count\":0,"));
Paging pageRequest = Paging.valueOf(1, 2);
paged = CollectionWithPagingInfo.asPaged(pageRequest, Arrays.asList(new Goat(), new Sheep("ABCD"), new Sheep("XYZ")));
out = writeResponse(helper.processAdditionsToTheResponse(mock(WebScriptResponse.class), api, null, Params.valueOf("notUsed", null, null), paged));
assertTrue("There must be json output as List with pagination", StringUtils.startsWith(out, "{\"list\":{\"pagination\":{\"count\":3,"));
paged = CollectionWithPagingInfo.asPaged(pageRequest, Arrays.asList(new Goat(), new Sheep("ABCD"), new Sheep("XYZ")), true, 5000);
out = writeResponse(helper.processAdditionsToTheResponse(mock(WebScriptResponse.class), api, null, Params.valueOf("notUsed", null, null), paged));
assertTrue("There must be json output as List with pagination", StringUtils.startsWith(out, "{\"list\":{\"pagination\":{\"count\":3,\"hasMoreItems\":true,\"totalItems\":5000"));
}
use of org.alfresco.rest.framework.tests.api.mocks.Sheep in project alfresco-remote-api by Alfresco.
the class SerializeTests method testSerializeSet.
@Test
public void testSerializeSet() throws IOException {
assertNotNull(helper);
Set<Object> aSet = new HashSet<Object>();
aSet.add(new Goat());
aSet.add(new Sheep("ABCD"));
aSet.add(new Sheep("XYZ"));
Object res = helper.processAdditionsToTheResponse(mock(WebScriptResponse.class), api, null, Params.valueOf("notUsed", null, null), aSet);
String out = writeResponse(res);
assertTrue("There must be json output", StringUtils.isNotBlank(out));
}
use of org.alfresco.rest.framework.tests.api.mocks.Sheep in project alfresco-remote-api by Alfresco.
the class SerializeTests method testSerializeUniqueId.
@Test
public void testSerializeUniqueId() throws IOException {
assertNotNull(helper);
Object res = helper.processAdditionsToTheResponse(mock(WebScriptResponse.class), api, null, Params.valueOf("notUsed", null, null), new Sheep("ABCD"));
String out = writeResponse(res);
assertTrue("Id field must be called sheepGuid.", StringUtils.contains(out, "\"sheepGuid\":\"ABCD\""));
}
Aggregations