### Question:
FileSegmentList implements SegmentList { @Override public void append(final Segment segment) { while (true) { final Segment[] curr = segmentList.get(); final Segment[] update = new Segment[curr.length + 1]; System.arraycopy(curr, 0, update, 0, curr.length); update[curr.length] = segment; if (segmentList.compareAndSet(curr, update)) { return; } } } 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 append() { File file = null; try { file = File.createTempFile("data", DataStoreUtils.nameFromOffset(0L, DataStoreUtils.DATA_FILE_SUFFIX)); file.createNewFile(); fileSegmentList = new FileSegmentList(); Segment fileSegment = new FileSegment(100L, file, true, SegmentType.DATA); String data = "abc"; fileSegment.append(ByteBuffer.wrap(data.getBytes())); fileSegment.flush(true); fileSegmentList.append(fileSegment); Segment[] segmentList = fileSegmentList.getView(); Assert.assertTrue(segmentList.length == 1); } catch (IOException e) { e.printStackTrace(); } finally { if (file != null) { file.deleteOnExit(); } } }