Skip to content

Commit

Permalink
Fix stubbings of experiment object as they’re used by the client
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsomunozpomer committed Oct 3, 2023
1 parent e6fb583 commit dd8e575
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
import uk.ac.ebi.atlas.model.experiment.sample.AssayGroup;
import uk.ac.ebi.atlas.model.experiment.sample.BiologicalReplicate;
import uk.ac.ebi.atlas.model.OntologyTerm;
import uk.ac.ebi.atlas.model.experiment.sdrf.Factor;
import uk.ac.ebi.atlas.model.experiment.sdrf.FactorSet;
import uk.ac.ebi.atlas.model.experiment.sdrf.SampleCharacteristic;
import uk.ac.ebi.atlas.model.experiment.ExperimentDesign;
import uk.ac.ebi.atlas.model.experiment.baseline.BaselineExperiment;

import java.util.Iterator;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.when;
Expand Down Expand Up @@ -64,31 +63,34 @@ public class BaselineExperimentAssayGroupsLinesTest {

@Test
public void lines() {
ExperimentDesign experimentDesign = new ExperimentDesign();

SampleCharacteristic sampleCharacteristic1 =
SampleCharacteristic.create(SAMPLE_HEADER, SAMPLE_VALUE1, SAMPLE_ONTOLOGY_TERM1);
SampleCharacteristic sampleCharacteristic2 =
SampleCharacteristic.create(SAMPLE_HEADER, SAMPLE_VALUE2, SAMPLE_ONTOLOGY_TERM2);

when(baselineExperiment.getAccession())
.thenReturn(EXPERIMENT_ACCESSION);
when(baselineExperiment.getDataColumnDescriptors())
.thenReturn(ImmutableList.of(ASSAY_GROUP1, ASSAY_GROUP2, ASSAY_GROUP3));

experimentDesign.putSampleCharacteristic(ASSAY1, SAMPLE_HEADER, sampleCharacteristic1);
experimentDesign.putFactor(ASSAY1, FACTOR_HEADER, FACTOR_VALUE1, FACTOR_ONTOLOGY_TERM1);
var sampleCharacteristic1 = SampleCharacteristic.create(SAMPLE_HEADER, SAMPLE_VALUE1, SAMPLE_ONTOLOGY_TERM1);
when(baselineExperiment.getSampleCharacteristics(ASSAY1)).thenReturn(ImmutableList.of(sampleCharacteristic1));

experimentDesign.putSampleCharacteristic(ASSAY2, SAMPLE_HEADER, sampleCharacteristic2);
experimentDesign.putFactor(ASSAY2, FACTOR_HEADER, FACTOR_VALUE2, FACTOR_ONTOLOGY_TERM2);
var sampleCharacteristic2 = SampleCharacteristic.create(SAMPLE_HEADER, SAMPLE_VALUE2, SAMPLE_ONTOLOGY_TERM2);
when(baselineExperiment.getSampleCharacteristics(ASSAY2)).thenReturn(ImmutableList.of(sampleCharacteristic2));

experimentDesign.putSampleCharacteristic(ASSAY3, SAMPLE_HEADER, SAMPLE_VALUE3);
experimentDesign.putFactor(ASSAY3, FACTOR_HEADER, FACTOR_VALUE3);
var sampleCharacteristic3 = SampleCharacteristic.create(SAMPLE_HEADER, SAMPLE_VALUE3);
when(baselineExperiment.getSampleCharacteristics(ASSAY3)).thenReturn(ImmutableList.of(sampleCharacteristic3));

var factorSet1 = new FactorSet();
factorSet1.add(new Factor(FACTOR_HEADER, FACTOR_VALUE1, FACTOR_ONTOLOGY_TERM1));
when(baselineExperiment.getFactors(ASSAY1)).thenReturn(factorSet1);

when(baselineExperiment.getAccession()).thenReturn(EXPERIMENT_ACCESSION);
when(baselineExperiment.getDataColumnDescriptors()).thenReturn(ImmutableList.of(ASSAY_GROUP1, ASSAY_GROUP2,
ASSAY_GROUP3));
var factorSet2 = new FactorSet();
factorSet2.add(new Factor(FACTOR_HEADER, FACTOR_VALUE2, FACTOR_ONTOLOGY_TERM2));
when(baselineExperiment.getFactors(ASSAY2)).thenReturn(factorSet2);

BaselineExperimentAssayGroupsLines subject = new BaselineExperimentAssayGroupsLines(baselineExperiment);
var factorSet3 = new FactorSet();
factorSet3.add(new Factor(FACTOR_HEADER, FACTOR_VALUE3));
when(baselineExperiment.getFactors(ASSAY3)).thenReturn(factorSet3);

Iterator<String[]> lines = subject.iterator();
var subject = new BaselineExperimentAssayGroupsLines(baselineExperiment);
var lines = subject.iterator();

assertThat(
lines.next(),
Expand Down

0 comments on commit dd8e575

Please sign in to comment.