### Question:
GenomeInterval implements Serializable, Comparable<GenomeInterval> { public GenomeInterval intersection(GenomeInterval other) { if (chr != other.chr) return new GenomeInterval(refDict, strand, chr, beginPos, beginPos, PositionType.ZERO_BASED); other = other.withStrand(strand); int beginPos = Math.max(this.beginPos, other.beginPos); int endPos = Math.min(this.endPos, other.endPos); if (endPos < beginPos) beginPos = endPos; return new GenomeInterval(refDict, strand, chr, beginPos, endPos, PositionType.ZERO_BASED); } GenomeInterval(ReferenceDictionary refDict, Strand strand, int chr, int beginPos, int endPos);  GenomeInterval(ReferenceDictionary refDict, Strand strand, int chr, int beginPos, int endPos,
						  PositionType positionType);  GenomeInterval(GenomePosition pos, int length); ReferenceDictionary getRefDict(); Strand getStrand(); int getChr(); int getBeginPos(); int getEndPos(); GenomeInterval withStrand(Strand strand); GenomePosition getGenomeBeginPos(); GenomePosition getGenomeEndPos(); int length(); GenomeInterval intersection(GenomeInterval other); GenomeInterval union(GenomeInterval other); boolean isLeftOf(GenomePosition pos); boolean isRightOf(GenomePosition pos); boolean isLeftOfGap(GenomePosition pos); boolean isRightOfGap(GenomePosition pos); boolean contains(GenomePosition pos); boolean contains(GenomeInterval other); GenomeInterval withMorePadding(int padding); GenomeInterval withMorePadding(int paddingUpstream, int paddingDownstream); boolean overlapsWith(GenomeInterval other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(GenomeInterval other);  }### Answer:
@Test public void testIntersection() { GenomeInterval intervalL = new GenomeInterval(refDict, Strand.FWD, 1, 1000, 1200, PositionType.ONE_BASED); GenomeInterval intervalR = new GenomeInterval(refDict, Strand.FWD, 1, 1100, 1300, PositionType.ONE_BASED); GenomeInterval intervalE = new GenomeInterval(refDict, Strand.FWD, 1, 1100, 1200, PositionType.ONE_BASED); Assert.assertEquals(intervalE, intervalL.intersection(intervalR)); Assert.assertEquals(intervalE, intervalR.intersection(intervalL)); }