@Test public void addNonIntersectingStopIntervalNeedNotBeInIntervalThatsMerged() { CompoundInterval ci = createCompoundIntervalWithoutRegister(); CompoundInterval toMerge = new CompoundInterval(DEFAULT_END + 1, DEFAULT_END + 2, null); BasicInterval otherInterval = new BasicInterval(DEFAULT_END + 1, DEFAULT_END + 3); toMerge.add(otherInterval); BasicInterval otherInterval2 = new BasicInterval(DEFAULT_END + 2, DEFAULT_END + 4); toMerge.add(otherInterval2); BasicInterval stop = new BasicInterval(DEFAULT_END + 1, DEFAULT_END + 4); ci.addNonIntersectingInterval(toMerge, stop); assertThat(ci.size(), is(3)); assertThat(ci.getLowerBound(), is(DEFAULT_BEGIN)); assertThat(ci.getUpperBound(), is(DEFAULT_END + 3)); }
@Test public void addNonIntersectingSetAddsAllIntervalsInTheOtherCompoundInterval() { CompoundInterval ci = createCompoundIntervalWithoutRegister(); CompoundInterval toMerge = new CompoundInterval(DEFAULT_END + 1, DEFAULT_END + 2, null); BasicInterval otherInterval = new BasicInterval(DEFAULT_END + 1, DEFAULT_END + 3); toMerge.add(otherInterval); BasicInterval otherInterval2 = new BasicInterval(DEFAULT_END + 2, DEFAULT_END + 4); toMerge.add(otherInterval2); BasicInterval stop = new BasicInterval(DEFAULT_END + 5, DEFAULT_END + 6); ci.addNonIntersectingInterval(toMerge, stop); assertThat(ci.size(), is(4)); assertThat(ci.getLowerBound(), is(DEFAULT_BEGIN)); assertThat(ci.getUpperBound(), is(DEFAULT_END + 4)); }