### Question:
BreakpointStoreOnCache implements DownloadStore { @NonNull @Override public BreakpointInfo createAndInsert(@NonNull DownloadTask task) { final int id = task.getId(); BreakpointInfo newInfo = new BreakpointInfo(id, task.getUrl(), task.getParentFile(), task.getFilename()); synchronized (this) { storedInfos.put(id, newInfo); unStoredTasks.remove(id); } return newInfo; } BreakpointStoreOnCache();   BreakpointStoreOnCache(SparseArray<BreakpointInfo> storedInfos,
                           List<Integer> fileDirtyList,
                           HashMap<String, String> responseFilenameMap,
                           SparseArray<IdentifiedTask> unStoredTasks,
                           List<Integer> sortedOccupiedIds,
                           KeyToIdMap keyToIdMap);  BreakpointStoreOnCache(SparseArray<BreakpointInfo> storedInfos,
                                  List<Integer> fileDirtyList,
                                  HashMap<String, String> responseFilenameMap); @Override BreakpointInfo get(int id); @NonNull @Override BreakpointInfo createAndInsert(@NonNull DownloadTask task); @Override void onTaskStart(int id); @Override void onSyncToFilesystemSuccess(@NonNull BreakpointInfo info, int blockIndex,
                                                    long increaseLength); @Override boolean update(@NonNull BreakpointInfo breakpointInfo); @Override void onTaskEnd(int id, @NonNull EndCause cause, @Nullable Exception exception); @Nullable @Override BreakpointInfo getAfterCompleted(int id); @Override boolean markFileDirty(int id); @Override boolean markFileClear(int id); @Override synchronized void remove(int id); @Override synchronized int findOrCreateId(@NonNull DownloadTask task); @Override BreakpointInfo findAnotherInfoFromCompare(@NonNull DownloadTask task,
                                                     @NonNull BreakpointInfo ignored); @Override boolean isOnlyMemoryCache(); @Override boolean isFileDirty(int id); @Nullable @Override String getResponseFilename(String url); static final int FIRST_ID; }### Answer:
@Test public void createAndInsert() { final DownloadTask task = mock(DownloadTask.class); when(task.getId()).thenReturn(insertedId); when(task.getParentFile()).thenReturn(new File("/p-path/")); when(task.getFilename()).thenReturn("filename"); when(task.getUrl()).thenReturn("url"); storeOnCache.createAndInsert(task); final BreakpointInfo info = storeOnCache.get(insertedId); assertThat(info).isNotNull(); assertThat(info.id).isEqualTo(insertedId); }