use of uk.ac.ebi.biosamples.client.BioSamplesClient in project biosamples-v4 by EBIBioSamples.
the class NcbiElementCallableTest method should_extract_double_organism_if_organism_is_in_description_with_null_amr_map.
@Test
public void should_extract_double_organism_if_organism_is_in_description_with_null_amr_map() throws Exception {
ArgumentCaptor<Sample> generatedSample = ArgumentCaptor.forClass(Sample.class);
when(bioSamplesClient.persistSampleResource(generatedSample.capture())).thenReturn(null);
NcbiSampleConversionService ncbiSampleConversionService = new NcbiSampleConversionService(taxonService);
NcbiElementCallable callable = new NcbiElementCallable(ncbiSampleConversionService, bioSamplesClient, sample, "test", null);
callable.call();
Sample sample = generatedSample.getValue();
List<Attribute> organisms = sample.getAttributes().stream().filter(attr -> attr.getType().equalsIgnoreCase("organism")).collect(Collectors.toList());
assertThat(organisms).hasSize(2);
assertThat(organisms.stream().anyMatch(organism -> organism.getValue().equals("Oryza sativa Japonica Group")));
assertThat(organisms.stream().anyMatch(organism -> organism.getValue().equals("Oryza sativa")));
}
use of uk.ac.ebi.biosamples.client.BioSamplesClient in project biosamples-v4 by EBIBioSamples.
the class NcbiElementCallableTest method should_extract_double_organism_if_organism_is_in_description.
@Test
public void should_extract_double_organism_if_organism_is_in_description() throws Exception {
ArgumentCaptor<Sample> generatedSample = ArgumentCaptor.forClass(Sample.class);
when(bioSamplesClient.persistSampleResource(generatedSample.capture())).thenReturn(null);
NcbiSampleConversionService ncbiSampleConversionService = new NcbiSampleConversionService(taxonService);
NcbiElementCallable callable = new NcbiElementCallable(ncbiSampleConversionService, bioSamplesClient, sample, "test", new HashMap<>());
callable.call();
Sample sample = generatedSample.getValue();
List<Attribute> organisms = sample.getAttributes().stream().filter(attr -> attr.getType().equalsIgnoreCase("organism")).collect(Collectors.toList());
assertThat(organisms).hasSize(2);
assertThat(organisms.stream().anyMatch(organism -> organism.getValue().equals("Oryza sativa Japonica Group")));
assertThat(organisms.stream().anyMatch(organism -> organism.getValue().equals("Oryza sativa")));
}
Aggregations