@Test public void intervalsDoNotIntersectWhenContainedIntervalsDoNotIntersectOtherWayRound() { CompoundInterval ci = new CompoundInterval(DEFAULT_END, DEFAULT_END + 1, null); ci.add(new MappedBasicInterval(DEFAULT_END + 1, DEFAULT_END + 2, null)); ci.add(new MappedBasicInterval(DEFAULT_END + 3, DEFAULT_END + 4, null)); CompoundInterval other = new CompoundInterval(1, DEFAULT_END, null); other.add(new MappedBasicInterval(DEFAULT_END + 2, DEFAULT_END + 3, null)); other.add(new MappedBasicInterval(DEFAULT_END + 5, DEFAULT_END + 7, null)); assertThat(ci.intersects(other), is(false)); }
@Test public void intervalsDoNotIntersectWhenFirstIntervalIsHigherThanTheOther() { CompoundInterval ci = new CompoundInterval(DEFAULT_END + 4, DEFAULT_END + 6, null); CompoundInterval other = createCompoundIntervalWithoutRegister(); assertThat(ci.intersects(other), is(false)); }
@Test public void compoundIntervalsDoNotIntersectWithEmptyIntervals() { CompoundInterval ci = createCompoundIntervalWithoutRegister(); assertThat(ci.intersects(new CompoundInterval(null)), is(false)); }
@Test public void registersDoNotMatterForIntersection() { CompoundInterval ci = new CompoundInterval(DEFAULT_BEGIN, DEFAULT_END, new Register(-1)); CompoundInterval otherCi = new CompoundInterval(DEFAULT_BEGIN, DEFAULT_END, new Register(-2)); assertThat(ci.intersects(otherCi), is(true)); }
@Test public void nonEmptyCompoundIntervalsIntersectWithThemselves() { CompoundInterval ci = createCompoundIntervalWithoutRegister(); assertThat(ci.intersects(ci), is(true)); }
@Test public void emptyCompoundIntervalsDoNotIntersectWithAnything() { CompoundInterval empty = new CompoundInterval(null); assertThat(empty.intersects(new CompoundInterval(null)), is(false)); }