private GeneLocationConfiguration createGeneLocationConfiguration(
     List<SegmentData> segmentDatas) {
   GeneLocationConfiguration configuration = new GeneLocationConfiguration();
   for (SegmentData segmentData : segmentDatas) {
     ChromosomalLocation location = segmentData.getLocation();
     GeneChromosomalLocation geneLocation = new GeneChromosomalLocation();
     geneLocation.setLocation(location);
     configuration.getGeneLocations().add(geneLocation);
   }
   return configuration;
 }
  /**
   * Unit test setup.
   *
   * @throws Exception on error
   */
  @Before
  public void setUp() throws Exception {
    Platform platform = dao.getPlatform("platformName");
    ReporterList reporterList =
        platform.addReporterList("reporterList", ReporterTypeEnum.DNA_ANALYSIS_REPORTER);

    study = new Study();
    query = new Query();
    query.setCopyNumberPlatform(platform);
    StudySubscription subscription = new StudySubscription();
    subscription.setStudy(study);
    query.setSubscription(subscription);
    StudySubjectAssignment assignment = new StudySubjectAssignment();
    study.getAssignmentCollection().add(assignment);
    SampleAcquisition acquisition = new SampleAcquisition();
    Sample sample = new Sample();
    Array array = new Array();
    array.setPlatform(platform);
    ArrayData arrayData = new ArrayData();
    arrayData.setStudy(study);
    arrayData.setArray(array);
    arrayData.getReporterLists().add(reporterList);
    reporterList.getArrayDatas().add(arrayData);
    arrayData.setSample(sample);
    sample.getSampleAcquisitions().add(acquisition);
    sample.getArrayDataCollection().add(arrayData);
    segmentData = new SegmentData();
    arrayData.getSegmentDatas().add(segmentData);
    segmentData.setArrayData(arrayData);
    acquisition.setSample(sample);
    assignment.getSampleAcquisitionCollection().add(acquisition);
    StudyConfiguration studyConfiguration = new StudyConfiguration();
    studyConfiguration.getGenomicDataSources().add(new GenomicDataSourceConfiguration());
    study.setStudyConfiguration(studyConfiguration);

    when(dao.findMatchingSegmentDatas(
            any(CopyNumberAlterationCriterion.class), any(Study.class), any(Platform.class)))
        .thenReturn(Arrays.asList(segmentData));
    when(dao.findMatchingSegmentDatasByLocation(
            anyListOf(SegmentData.class), any(Study.class), any(Platform.class)))
        .thenReturn(Arrays.asList(segmentData));
  }
  private List<SegmentData> createSegmentDatas() {
    List<SegmentData> dataSet = new ArrayList<SegmentData>();
    SegmentData result = new SegmentData();
    result.setArrayData(new ArrayData());
    result.getArrayData().setSample(new Sample());
    result.getArrayData().getSample().setName("Sample 1");
    result.setLocation(new ChromosomalLocation());
    result.getLocation().setChromosome("1");
    result.getLocation().setStartPosition(Integer.valueOf(1));
    result.getLocation().setEndPosition(Integer.valueOf(5));
    result.setSegmentValue(Float.valueOf("0.1"));
    dataSet.add(result);

    result = new SegmentData();
    result.setArrayData(new ArrayData());
    result.getArrayData().setSample(new Sample());
    result.getArrayData().getSample().setName("Sample 2");
    result.setLocation(new ChromosomalLocation());
    result.getLocation().setChromosome("2");
    result.getLocation().setStartPosition(Integer.valueOf(6));
    result.getLocation().setEndPosition(Integer.valueOf(9));
    result.setSegmentValue(Float.valueOf("0.2"));
    dataSet.add(result);

    return dataSet;
  }