### Question:
SegmentInputStream extends InputStream { protected int segmentEnd() { if (end == -1) { for (end = rpos; end < src.length() && src.charAt(end) != '.'; end++); } return end; } SegmentInputStream(String src, int start); @Override int read(); @Override int available(); @Override boolean markSupported(); @Override synchronized void reset();  }### Answer:
@Test public void testSegmentEnd() throws IOException { String src = "hello world"; SegmentInputStream s = newSegmentInputStream(src, src.length()); assertEquals(0, s.available()); assertEquals(-1, s.read()); }
@Test public void testSegmentENd() { String s1 = "hello"; String s2 = "hello."; SegmentInputStream sis1 = newSegmentInputStream(s1); SegmentInputStream sis2 = newSegmentInputStream(s2); assertEquals(sis1.segmentEnd(), sis2.segmentEnd()); }