use of org.icgc.dcc.song.server.model.entity.Sample in project SONG by overture-stack.
the class SampleServiceTest method testCreateAndDeleteSample.
@Test
public void testCreateAndDeleteSample() {
val specimenId = "SP2";
val metadata = JsonUtils.fromSingleQuoted("{'ageCategory': 3, 'species': 'human'}");
val s = Sample.create("", "101-IP-A", specimenId, "Amplified DNA");
s.setInfo(metadata);
val status = sampleService.create(DEFAULT_STUDY_ID, s);
val id = s.getSampleId();
assertThat(sampleService.isSampleExist(id)).isTrue();
assertThat(id).startsWith("SA");
assertThat(status).isEqualTo(id);
Sample check = sampleService.read(id);
assertThat(check).isEqualToComparingFieldByField(s);
sampleService.delete(newArrayList(id));
assertThat(sampleService.isSampleExist(id)).isFalse();
}
use of org.icgc.dcc.song.server.model.entity.Sample in project SONG by overture-stack.
the class SampleServiceTest method testUpdateSpecimenDNE.
@Test
public void testUpdateSpecimenDNE() {
val randomSampleId = randomGenerator.generateRandomUUIDAsString();
val sample = new Sample();
sample.setSampleSubmitterId(randomGenerator.generateRandomUUIDAsString());
sample.setSampleId(randomSampleId);
sample.setSampleType(randomGenerator.randomElement(newArrayList(SAMPLE_TYPE)));
sample.setSpecimenId(DEFAULT_SPECIMEN_ID);
assertSongError(() -> sampleService.update(sample), SAMPLE_DOES_NOT_EXIST);
}
Aggregations