use of net.javacrumbs.jsonunit.fluent.JsonFluentAssert in project crnk-framework by crnk-project.
the class BasicSpringBootTest method testRelationshipInclusion.
@Test
public void testRelationshipInclusion() {
Project project = new Project();
ProjectRepository projectRepository = new ProjectRepository();
projectRepository.save(project);
Task task = new Task();
task.setProject(project);
TaskRepository taskRepository = new TaskRepository();
taskRepository.save(task);
RestTemplate testRestTemplate = new RestTemplate();
ResponseEntity<String> response = testRestTemplate.getForEntity("http://localhost:" + this.port + "/api/tasks?include[tasks]=schedule%2Cproject", String.class);
assertEquals(HttpStatus.OK, response.getStatusCode());
JsonFluentAssert included = assertThatJson(response.getBody()).node("included");
included.isArray().ofLength(1);
}
Aggregations