use of ca.corefacility.bioinformatics.irida.ria.web.models.UISampleFilter in project irida by phac-nml.
the class ProjectSamplesControllerTest method testGetAjaxProjectSampleModels.
@SuppressWarnings("unchecked")
@Test
public void testGetAjaxProjectSampleModels() {
Sample sample = TestDataFactory.constructSample();
when(projectService.read(anyLong())).thenReturn(project);
when(sampleService.getSamplesForProject(any(Project.class))).thenReturn(ImmutableList.of(new ProjectSampleJoin(project, sample, true)));
when(sampleService.getFilteredSamplesForProjects(any(List.class), any(List.class), any(String.class), any(String.class), any(String.class), any(Date.class), any(Date.class), any(Integer.class), any(Integer.class), any(Sort.class))).thenReturn(TestDataFactory.getPageOfProjectSampleJoin());
DataTablesParams params = mock(DataTablesParams.class);
when(params.getSort()).thenReturn(new Sort(Direction.ASC, "sample.sampleName"));
DataTablesResponse response = controller.getProjectSamples(1L, params, ImmutableList.of(), ImmutableList.of(), new UISampleFilter(), Locale.US);
List<DataTablesResponseModel> data = response.getData();
assertEquals("Has the correct number of samples", 1, data.size());
DTProjectSamples sampleData = (DTProjectSamples) data.get(0);
assertEquals("Has the correct sample", "Joined Sample", sampleData.getSampleName());
}
Aggregations