### Question:
FileSpan { boolean inSpan(Offset offset) { return offset.compareTo(startOffset) >= 0 && offset.compareTo(endOffset) < 0; } FileSpan(Offset startOffset, Offset endOffset); @Override String toString();  }### Answer:
@Test public void inSpanTest() { String firstLogSegmentName = LogSegmentNameHelper.generateFirstSegmentName(true); String startLogSegmentName = LogSegmentNameHelper.getNextPositionName(firstLogSegmentName); String interveningLogSegmentName = LogSegmentNameHelper.getNextPositionName(startLogSegmentName); String endLogSegmentName = LogSegmentNameHelper.getNextPositionName(interveningLogSegmentName); long startOffsetInStartLogSegment = 100; long endOffsetInEndLogSegment = 100; FileSpan span = new FileSpan(new Offset(startLogSegmentName, startOffsetInStartLogSegment), new Offset(endLogSegmentName, endOffsetInEndLogSegment)); long testOffsetStart = 0; long testOffsetEnd = 200; for (String segmentName : new String[]{firstLogSegmentName, startLogSegmentName, interveningLogSegmentName, endLogSegmentName}) { for (long offsetInSegment = testOffsetStart; offsetInSegment <= testOffsetEnd; offsetInSegment++) { Offset offset = new Offset(segmentName, offsetInSegment); boolean inSpan = segmentName.equals(interveningLogSegmentName) || (segmentName.equals(startLogSegmentName) && offsetInSegment >= startOffsetInStartLogSegment) || (segmentName.equals(endLogSegmentName) && offsetInSegment < endOffsetInEndLogSegment); assertEquals("inSpan() result not as expected", inSpan, span.inSpan(offset)); } } }