### Question:
FileSegmentList implements SegmentList { @Override public List<Segment> getView() { return segmentList.get(); } FileSegmentList(final File segListDir, final SegmentType type,
                           boolean needCreate, final long offsetIfCreate,
                           final long lastCheckOffset, StringBuilder sBuilder); @Override void close(); @Override List<Segment> getView(); @Override RecordView getRecordView(final long offset, final int maxSize); @Override void relRecordView(RecordView recordView); @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 dir = new File("src/test/resource/data"); dir.mkdir(); try { File file = new File("src/test/resource/data", DataStoreUtils.nameFromOffset(0L, DataStoreUtils.DATA_FILE_SUFFIX)); file.createNewFile(); fileSegmentList = new FileSegmentList(dir, SegmentType.DATA, true, 0L, Long.MAX_VALUE, new StringBuilder()); Segment fileSegment = fileSegmentList.last(); String data = "abc"; fileSegment.append(ByteBuffer.wrap(data.getBytes())); fileSegment.flush(true); List<Segment> segmentList = fileSegmentList.getView(); Assert.assertTrue(segmentList.size() == 1); file.delete(); } catch (IOException e) { e.printStackTrace(); } finally { if (dir.exists()) { dir.delete(); } } }