### Question:
InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= leftPartitionWidth) { throw new IndexOutOfBoundsException("Width of left partition is greater than or equal to span: span width =" + width + ", partitionWidth = " + leftPartitionWidth); } return new StreamElementPartition<InvariantSpan>(new InvariantSpan(start, leftPartitionWidth, documentHash), new InvariantSpan(start + leftPartitionWidth, width - leftPartitionWidth, documentHash)); } InvariantSpan();  InvariantSpan(long start, long width, String documentHash); @Override InvariantSpan copy(); @Override boolean equals(Object obj); String getDocumentHash(); long getStart(); @Override long getWidth(); @Override int hashCode(); boolean hashDocumentHash(); void setStart(long start); @Override void setWidth(long width); @Override StreamElementPartition<InvariantSpan> split(long leftPartitionWidth); @Override String toString();  }### Answer:
@Test public void split() throws Exception { InvariantSpan span = new InvariantSpan(1, 4, documentHash); StreamElementPartition<InvariantSpan> result = span.split(1); assertEquals(new InvariantSpan(1, 1, documentHash), result.getLeft()); assertEquals(new InvariantSpan(2, 3, documentHash), result.getRight()); }
@Test public void splitEnd() throws Exception { InvariantSpan span = new InvariantSpan(1, 4, documentHash); StreamElementPartition<InvariantSpan> part = span.split(3); assertEquals(new InvariantSpan(1, 3, documentHash), part.getLeft()); assertEquals(new InvariantSpan(4, 1, documentHash), part.getRight()); }
@Test(expected = IndexOutOfBoundsException.class) public void splitOverUpperBound() throws Exception { InvariantSpan span = new InvariantSpan(100, 10, documentHash); span.split(15); }
@Test(expected = IndexOutOfBoundsException.class) public void splitStart() throws Exception { InvariantSpan span = new InvariantSpan(1, 4, documentHash); span.split(0); }