when(componentDao.getNullableRootProjectByKey(project.key(), session)).thenReturn(project);
when(componentDao.findModulesByProject(project.key(), session)).thenReturn(newArrayList(module));
when(componentDao.findModulesByProject(module.key(), session)).thenReturn(newArrayList(subModule));
when(propertiesDao.selectProjectProperties(project.key(), session)).thenReturn(newArrayList(
new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
));
when(propertiesDao.selectProjectProperties(module.key(), session)).thenReturn(newArrayList(
new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER"),
new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
));
when(propertiesDao.selectProjectProperties(subModule.key(), session)).thenReturn(newArrayList(
new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR-SERVER-DAO")
));
WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", project.key());
request.execute().assertJson(getClass(), "return_project_with_module_with_sub_module.json");
}