FileLogDataStore extends AbstractMemoryLogStore implements LogDataStore { @Override public int clear() { int size = logDatasId.size(); RandomAccessFile old = randomAccessFile; storeIdFilePositionMapping.clear(); logDatasId.clear(); try { init(); } catch (IOException e) { LOGGER.info("Can't initialize new log file after clear: " + e.getMessage()); return 0; } try { old.close(); } catch (IOException e) { LOGGER.warn("Can't close temporary file: " + e.getMessage()); } return size; } FileLogDataStore(); @Override Iterator<LogData> iterator(); @Override int getCount(); @Override void add(LogData... logDatas); @Override void remove(int... rows); @Override LogData getLogData(int row); @Override Integer getLogDataIdInRow(int row); @Override LogData[] getLogData(); @Override int clear(); void addNoteToRow(int row, Note note); Note getNote(int row); Note removeNote(int row); void removeNote(int row, boolean notify); void clearNotes(); TreeMap<Integer, Note> getAllNotes(); @Override boolean isMarked(int row); @Override MarkerColors getMarkerColors(int row); @Override void markRows(MarkerColors markerColor, int... rows); @Override void unmarkRows(int... rows);  }
@Test public void testClear() { dataStore.add(logDatas); assertEquals(logDatas.length, dataStore.getCount()); dataStore.clear(); assertEquals(0, dataStore.getCount()); assertEquals(0, dataStore.getLogData().length); }