use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl in project miso-lims by miso-lims.
the class DefaultSampleServiceTest method nullSampleNameTest.
@Test
public void nullSampleNameTest() throws Exception {
Sample sample = new SampleImpl();
sample.setName(null);
assertFalse("Non-temporary sample names must return false.", hasTemporaryName(sample));
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl in project miso-lims by miso-lims.
the class DefaultSampleServiceTest method temporarySampleNameTest.
@Test
public void temporarySampleNameTest() throws Exception {
Sample sample = new SampleImpl();
sample.setName(LimsUtils.generateTemporaryName());
assertTrue("Temporary sample names must return true.", hasTemporaryName(sample));
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl in project miso-lims by miso-lims.
the class DefaultSampleServiceTest method testNonUniqueExternalNamePerProjectFailTest.
@Test
public void testNonUniqueExternalNamePerProjectFailTest() throws IOException {
Project project = new ProjectImpl();
project.setId(1L);
project.setReferenceGenome(humanReferenceGenome());
IdentityView id1 = new IdentityView();
id1.setId(1L);
id1.setExternalName("String1,String2");
id1.setProjectId(project.getId());
Sample newSample = new SampleImpl();
newSample.setProject(project);
Mockito.when(sut.getIdentitiesByExternalNameOrAliasAndProject(Matchers.anyString(), Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(Collections.singletonList(id1));
exception.expect(ValidationException.class);
sut.confirmExternalNameUniqueForProjectIfRequired("String1,String3", newSample);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl in project miso-lims by miso-lims.
the class DefaultSampleServiceTest method testNonUniqueExternalNamePerProjectPassTest.
@Test
public void testNonUniqueExternalNamePerProjectPassTest() throws IOException {
Project project = new ProjectImpl();
project.setId(1L);
project.setReferenceGenome(humanReferenceGenome());
IdentityView id1 = new IdentityView();
id1.setExternalName("String1,String2");
id1.setProjectId(project.getId());
sut.setUniqueExternalNameWithinProjectRequired(false);
Mockito.when(sut.getIdentitiesByExternalNameOrAliasAndProject(Matchers.anyString(), Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(Collections.singletonList(id1));
Sample newSample = new SampleImpl();
newSample.setProject(project);
sut.confirmExternalNameUniqueForProjectIfRequired("String1", newSample);
}
use of uk.ac.bbsrc.tgac.miso.core.data.impl.SampleImpl in project miso-lims by miso-lims.
the class DefaultSampleServiceTest method testCanEditExternalNameTest.
@Test
public void testCanEditExternalNameTest() throws IOException {
Project project = new ProjectImpl();
project.setId(1L);
project.setReferenceGenome(humanReferenceGenome());
IdentityView id1 = new IdentityView();
id1.setId(1L);
id1.setExternalName("String1,String2");
id1.setProjectId(project.getId());
Mockito.when(sut.getIdentitiesByExternalNameOrAliasAndProject(Matchers.anyString(), Matchers.anyLong(), Matchers.anyBoolean())).thenReturn(Collections.singletonList(id1));
Sample newSample = new SampleImpl();
newSample.setProject(project);
exception.expect(ValidationException.class);
sut.confirmExternalNameUniqueForProjectIfRequired("String1", newSample);
}
Aggregations