Search in sources :

Example 6 with Specimen

use of org.icgc.dcc.song.server.model.entity.Specimen in project SONG by overture-stack.

the class SpecimenServiceTest method testCreateAndDeleteSpecimen.

@Test
public void testCreateAndDeleteSpecimen() {
    val donorId = "DO2";
    Specimen s = Specimen.create("", "Specimen 101 Ipsilon Prime", donorId, "Tumour", "Cell line - derived from tumour");
    s.setInfo(JsonUtils.fromSingleQuoted("{'ageCategory': 42, 'status': 'deceased'}"));
    val status = specimenService.create(DEFAULT_STUDY_ID, s);
    val id = s.getSpecimenId();
    assertThat(id).startsWith("SP");
    Assertions.assertThat(status).isEqualTo(id);
    val check = specimenService.read(id);
    assertThat(s).isEqualToComparingFieldByField(check);
    val response = specimenService.delete(newArrayList(id));
    assertThat(specimenService.isSpecimenExist(id)).isFalse();
    assertThat(response).isEqualTo("OK");
}
Also used : lombok.val(lombok.val) Specimen(org.icgc.dcc.song.server.model.entity.Specimen) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

lombok.val (lombok.val)6 Specimen (org.icgc.dcc.song.server.model.entity.Specimen)6 Test (org.junit.Test)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5 Sample (org.icgc.dcc.song.server.model.entity.Sample)2 Maps (com.google.common.collect.Maps)1 Collection (java.util.Collection)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Slf4j (lombok.extern.slf4j.Slf4j)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 RandomGenerator (org.icgc.dcc.song.core.utils.RandomGenerator)1 RandomGenerator.createRandomGenerator (org.icgc.dcc.song.core.utils.RandomGenerator.createRandomGenerator)1 SequencingReadAnalysis (org.icgc.dcc.song.server.model.analysis.SequencingReadAnalysis)1 Donor (org.icgc.dcc.song.server.model.entity.Donor)1 CompositeEntity (org.icgc.dcc.song.server.model.entity.composites.CompositeEntity)1 DonorWithSpecimens (org.icgc.dcc.song.server.model.entity.composites.DonorWithSpecimens)1 SpecimenWithSamples (org.icgc.dcc.song.server.model.entity.composites.SpecimenWithSamples)1 AnalysisGenerator.createAnalysisGenerator (org.icgc.dcc.song.server.utils.AnalysisGenerator.createAnalysisGenerator)1 StudyGenerator (org.icgc.dcc.song.server.utils.StudyGenerator)1 StudyGenerator.createStudyGenerator (org.icgc.dcc.song.server.utils.StudyGenerator.createStudyGenerator)1