use of io.crnk.core.mock.models.LazyTask in project crnk-framework by crnk-project.
the class DocumentMapperTest method testRelationshipLazyMultiValued.
@Test
public void testRelationshipLazyMultiValued() {
LazyTask task = createLazyTask(2);
Project project1 = createProject(3, "sample project");
Project project2 = createProject(4, "sample project");
task.setProjects(Arrays.asList(project1, project2));
Document document = mapper.toDocument(toResponse(task), createAdapter(Task.class));
Resource resource = document.getSingleData().get();
Assert.assertEquals("2", resource.getId());
Relationship relationship = resource.getRelationships().get("projects");
Assert.assertNotNull(relationship);
Nullable<List<ResourceIdentifier>> relationshipData = relationship.getCollectionData();
Assert.assertFalse(relationshipData.isPresent());
Assert.assertTrue(document.getIncluded().isEmpty());
}
Aggregations