Source:
<code>public void testMergeSimilarSegmentsWithoutRefitting() { final boolean doRefit = false; final JavaSparkContext ctx = SparkContextFactory.getTestSparkContext(); LoggingUtils.setLoggingLevel(Log.LogLevel.INFO); final String tempDir = publicTestDir + "similar-segment-test-without-refitting"; final File tempDirFile = createTempDir(tempDir); final Genome genome = new Genome(COVERAGES_FILE, TUMOR_ALLELIC_COUNTS_FILE, SAMPLE_NAME); final SegmentedModel segmentedModel = new SegmentedModel(SEGMENT_FILE, genome); final ACNVModeller modeller = new ACNVModeller(segmentedModel, NUM_SAMPLES, NUM_BURN_IN, NUM_SAMPLES, NUM_BURN_IN, ctx); Assert.assertTrue(modeller.isModelFit()); int prevNumSegments; for (int numIterations = 1; numIterations <= MAX_SIMILAR_SEGMENT_MERGE_ITERATIONS; numIterations++) { prevNumSegments = modeller.getACNVModeledSegments().size(); modeller.performSimilarSegmentMergingIteration(INTERVAL_THRESHOLD, INTERVAL_THRESHOLD, doRefit); if (modeller.getACNVModeledSegments().size() == prevNumSegments) { break; } } Assert.assertTrue(!modeller.isModelFit()); final File finalModeledSegmentsFile = new File(tempDirFile.getAbsolutePath() + "/test-" + FINAL_SEG_FILE_TAG + ".seg"); modeller.writeACNVModeledSegmentFile(finalModeledSegmentsFile); Assert.assertTrue(modeller.isModelFit()); <START> final int expectedNumberOfSegments = 31; <END> final List<SimpleInterval> segmentsResult = SegmentUtils.readIntervalsFromSegmentFile(finalModeledSegmentsFile); Assert.assertEquals(segmentsResult.size(), expectedNumberOfSegments); }</code><technical_language>Magic number depends input data. Please assign a constant in preamble yet, a truth segmented model file test equality (similar do in testMergeSimilarSegments). Also, please consider renaming testMergeSimilarSegments testMergeSimilarSegmentsWithRefitting</technical_language>

Target:
public void testMergeSimilarSegmentsWithoutRefitting() { final boolean doRefit = false; final JavaSparkContext ctx = SparkContextFactory.getTestSparkContext(); LoggingUtils.setLoggingLevel(Log.LogLevel.INFO); final String tempDir = publicTestDir + "similar-segment-test-without-refitting"; final File tempDirFile = createTempDir(tempDir); final Genome genome = new Genome(COVERAGES_FILE, TUMOR_ALLELIC_COUNTS_FILE, SAMPLE_NAME); final SegmentedModel segmentedModel = new SegmentedModel(SEGMENT_FILE, genome); final ACNVModeller modeller = new ACNVModeller(segmentedModel, NUM_SAMPLES, NUM_BURN_IN, NUM_SAMPLES, NUM_BURN_IN, ctx); Assert.assertTrue(modeller.isModelFit()); int prevNumSegments; for (int numIterations = 1; numIterations <= MAX_SIMILAR_SEGMENT_MERGE_ITERATIONS; numIterations++) { prevNumSegments = modeller.getACNVModeledSegments().size(); modeller.performSimilarSegmentMergingIteration(INTERVAL_THRESHOLD, INTERVAL_THRESHOLD, doRefit); if (modeller.getACNVModeledSegments().size() == prevNumSegments) { break; } } Assert.assertTrue(!modeller.isModelFit()); final File finalModeledSegmentsFile = new File(tempDirFile.getAbsolutePath() + "/test-" + FINAL_SEG_FILE_TAG + ".seg"); modeller.writeACNVModeledSegmentFile(finalModeledSegmentsFile); Assert.assertTrue(modeller.isModelFit()); final List<SimpleInterval> segmentsResult = SegmentUtils.readIntervalsFromSegmentFile(finalModeledSegmentsFile); Assert.assertEquals(segmentsResult.size(), SEGMENTS_TRUTH.size(), DELTA_NUM_SEGMENTS_WITHOUT_REFITTING); }