TrackStore implements BaseService { public void setUploading(@NonNull TrackFile trackFile) { final TrackState state = trackState.get(trackFile); if (state instanceof TrackState.TrackNotUploaded) { trackState.put(trackFile, new TrackState.TrackUploading(trackFile)); } else { Log.e(TAG, "Invalid track state transition: " + state + " -> uploading"); } }  @Override void start(@NonNull Context context); @NonNull List<TrackFile> getLocalTracks(); @Override void stop(); void setUploading(@NonNull TrackFile trackFile); int getUploadProgress(@NonNull TrackFile trackFile); boolean isUploading(@NonNull TrackFile trackFile); @Nullable TrackMetadata getCloudData(@NonNull TrackFile trackFile); boolean delete(@NonNull TrackFile trackFile);  }
@Test public void setUploading() throws Exception { TrackStore store = new TrackStore(); File file = Files.createTempFile("tmp", ".csv.gz").toFile(); TrackFile trackFile = new TrackFile(file); store.setRecording(trackFile); assertFalse(store.isUploading(trackFile)); store.setNotUploaded(trackFile); assertFalse(store.isUploading(trackFile)); store.setUploading(trackFile); assertTrue(store.isUploading(trackFile)); assertEquals(0, store.getUploadProgress(trackFile)); store.setUploadProgress(trackFile, 1000); assertEquals(1000, store.getUploadProgress(trackFile)); TrackMetadata cloudData = new MockTrackMetadata(); store.setUploadSuccess(trackFile, cloudData); assertFalse(store.isUploading(trackFile)); assertEquals(cloudData, store.getCloudData(trackFile)); }