### Question:
FileSegmentList implements SegmentList { @Override public Segment[] getView() { return segmentList.get(); } FileSegmentList(final Segment[] s);  FileSegmentList(); @Override void close(); @Override Segment[] getView(); @Override Segment getRecordSeg(final long offset); @Override void append(final Segment segment); @Override boolean checkExpiredSegments(final long checkTimestamp, final long fileValidTimeMs); @Override void delExpiredSegments(final StringBuilder sb); @Override void delete(final Segment segment); @Override void flushLast(boolean force); @Override Segment last(); @Override long getMinOffset(); @Override long getMaxOffset(); @Override long getCommitMaxOffset(); @Override long getSizeInBytes(); @Override Segment findSegment(final long offset);  }### Answer:
@Test public void getView() { File file = null; try { file = File.createTempFile("data", DataStoreUtils.nameFromOffset(0L, DataStoreUtils.DATA_FILE_SUFFIX)); fileSegmentList = new FileSegmentList(); fileSegmentList.append(new FileSegment(0, file, SegmentType.DATA)); Segment fileSegment = fileSegmentList.last(); String data = "abc"; fileSegment.append(ByteBuffer.wrap(data.getBytes())); fileSegment.flush(true); Segment[] segmentList = fileSegmentList.getView(); Assert.assertTrue(segmentList.length == 1); file.delete(); } catch (IOException e) { e.printStackTrace(); } finally { if (file != null) { file.deleteOnExit(); } } }