test_class.declarator: TASK_TITLE = "title"
test_class.modifier: private final static
test_class.original_string: private final static String TASK_TITLE = "title";
test_class.type: String
test_class.var_name: TASK_TITLE
test_class.declarator: TASK_TITLE2 = "title2"
test_class.modifier: private final static
test_class.original_string: private final static String TASK_TITLE2 = "title2";
test_class.type: String
test_class.var_name: TASK_TITLE2
test_class.declarator: TASK_TITLE3 = "title3"
test_class.modifier: private final static
test_class.original_string: private final static String TASK_TITLE3 = "title3";
test_class.type: String
test_class.var_name: TASK_TITLE3
test_class.declarator: TASKS = Lists.newArrayList(new Task("Title1", "Description1"),
              new Task("Title2", "Description2"))
test_class.modifier: private static
test_class.original_string: private static List<Task> TASKS = Lists.newArrayList(new Task("Title1", "Description1"),
              new Task("Title2", "Description2"));
test_class.type: List<Task>
test_class.var_name: TASKS
test_class.declarator: mTasksRepository
test_class.modifier: private
test_class.original_string: private TasksRepository mTasksRepository;
test_class.type: TasksRepository
test_class.var_name: mTasksRepository
test_class.declarator: mTasksTestSubscriber
test_class.modifier: private
test_class.original_string: private TestSubscriber<List<Task>> mTasksTestSubscriber;
test_class.type: TestSubscriber<List<Task>>
test_class.var_name: mTasksTestSubscriber
test_class.declarator: mTasksRemoteDataSource
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private TasksDataSource mTasksRemoteDataSource;
test_class.type: TasksDataSource
test_class.var_name: mTasksRemoteDataSource
test_class.declarator: mTasksLocalDataSource
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private TasksDataSource mTasksLocalDataSource;
test_class.type: TasksDataSource
test_class.var_name: mTasksLocalDataSource
test_class.declarator: mContext
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private Context mContext;
test_class.type: Context
test_class.var_name: mContext
test_class.file: data/src/test/java/com/example/data/source/TasksRepositoryTest.java
test_class.identifier: TasksRepositoryTest
test_case.body: @Test
      public void saveTask_savesTaskToServiceAPI() {
          // Given a stub task with title and description
          Task newTask = new Task(TASK_TITLE, "Some Task Description");
  
          // When a task is saved to the tasks repository
          mTasksRepository.saveTask(newTask);
  
          // Then the service API and persistent repository are called and the cache is updated
          Mockito.verify(mTasksRemoteDataSource).saveTask(newTask);
          Mockito.verify(mTasksLocalDataSource).saveTask(newTask);
          assertThat(mTasksRepository.mCachedTasks.size(), CoreMatchers.is(1));
      }
test_case.class_method_signature: TasksRepositoryTest.saveTask_savesTaskToServiceAPI()
test_case.full_signature: @Test public void saveTask_savesTaskToServiceAPI()
test_case.identifier: saveTask_savesTaskToServiceAPI
test_case.invocations: saveTask saveTask verify saveTask verify assertThat size is
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void saveTask_savesTaskToServiceAPI()
focal_class.declarator: INSTANCE = null
focal_class.modifier: @Nullable
      private static
focal_class.original_string: @Nullable
      private static TasksRepository INSTANCE = null;
focal_class.type: TasksRepository
focal_class.var_name: INSTANCE
focal_class.declarator: mTasksRemoteDataSource
focal_class.modifier: @NonNull
      private final
focal_class.original_string: @NonNull
      private final TasksDataSource mTasksRemoteDataSource;
focal_class.type: TasksDataSource
focal_class.var_name: mTasksRemoteDataSource
focal_class.declarator: mTasksLocalDataSource
focal_class.modifier: @NonNull
      private final
focal_class.original_string: @NonNull
      private final TasksDataSource mTasksLocalDataSource;
focal_class.type: TasksDataSource
focal_class.var_name: mTasksLocalDataSource
focal_class.declarator: mCachedTasks
focal_class.modifier: @VisibleForTesting
      @Nullable
focal_class.original_string: @VisibleForTesting
      @Nullable
      Map<String, Task> mCachedTasks;
focal_class.type: Map<String, Task>
focal_class.var_name: mCachedTasks
focal_class.declarator: mCacheIsDirty = false
focal_class.modifier: @VisibleForTesting
focal_class.original_string: @VisibleForTesting
      boolean mCacheIsDirty = false;
focal_class.type: boolean
focal_class.var_name: mCacheIsDirty
focal_class.file: data/src/main/java/com/example/data/source/TasksRepository.java
focal_class.identifier: TasksRepository
focal_class.interfaces: implements TasksDataSource
focal_class.class_method_signature: TasksRepository.TasksRepository(@NonNull TasksDataSource tasksRemoteDataSource,
                              @NonNull TasksDataSource tasksLocalDataSource)
focal_class.full_signature: private  TasksRepository(@NonNull TasksDataSource tasksRemoteDataSource,
                              @NonNull TasksDataSource tasksLocalDataSource)
focal_class.identifier: TasksRepository
focal_class.modifiers: private
focal_class.parameters: (@NonNull TasksDataSource tasksRemoteDataSource,
                              @NonNull TasksDataSource tasksLocalDataSource)
focal_class.signature:  TasksRepository(@NonNull TasksDataSource tasksRemoteDataSource,
                              @NonNull TasksDataSource tasksLocalDataSource)
focal_class.class_method_signature: TasksRepository.getInstance(@NonNull TasksDataSource tasksRemoteDataSource,
                                                @NonNull TasksDataSource tasksLocalDataSource)
focal_class.full_signature: public static TasksRepository getInstance(@NonNull TasksDataSource tasksRemoteDataSource,
                                                @NonNull TasksDataSource tasksLocalDataSource)
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: (@NonNull TasksDataSource tasksRemoteDataSource,
                                                @NonNull TasksDataSource tasksLocalDataSource)
focal_class.return: TasksRepository
focal_class.signature: TasksRepository getInstance(@NonNull TasksDataSource tasksRemoteDataSource,
                                                @NonNull TasksDataSource tasksLocalDataSource)
focal_class.class_method_signature: TasksRepository.destroyInstance()
focal_class.full_signature: public static void destroyInstance()
focal_class.identifier: destroyInstance
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void destroyInstance()
focal_class.class_method_signature: TasksRepository.getTasks()
focal_class.full_signature: @Override public Flowable<List<Task>> getTasks()
focal_class.identifier: getTasks
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Flowable<List<Task>>
focal_class.signature: Flowable<List<Task>> getTasks()
focal_class.class_method_signature: TasksRepository.getAndCacheLocalTasks()
focal_class.full_signature: private Flowable<List<Task>> getAndCacheLocalTasks()
focal_class.identifier: getAndCacheLocalTasks
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Flowable<List<Task>>
focal_class.signature: Flowable<List<Task>> getAndCacheLocalTasks()
focal_class.class_method_signature: TasksRepository.getAndSaveRemoteTasks()
focal_class.full_signature: private Flowable<List<Task>> getAndSaveRemoteTasks()
focal_class.identifier: getAndSaveRemoteTasks
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Flowable<List<Task>>
focal_class.signature: Flowable<List<Task>> getAndSaveRemoteTasks()
focal_class.class_method_signature: TasksRepository.saveTask(@NonNull Task task)
focal_class.full_signature: @Override public void saveTask(@NonNull Task task)
focal_class.identifier: saveTask
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull Task task)
focal_class.return: void
focal_class.signature: void saveTask(@NonNull Task task)
focal_class.class_method_signature: TasksRepository.completeTask(@NonNull Task task)
focal_class.full_signature: @Override public void completeTask(@NonNull Task task)
focal_class.identifier: completeTask
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull Task task)
focal_class.return: void
focal_class.signature: void completeTask(@NonNull Task task)
focal_class.class_method_signature: TasksRepository.completeTask(@NonNull String taskId)
focal_class.full_signature: @Override public void completeTask(@NonNull String taskId)
focal_class.identifier: completeTask
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull String taskId)
focal_class.return: void
focal_class.signature: void completeTask(@NonNull String taskId)
focal_class.class_method_signature: TasksRepository.activateTask(@NonNull Task task)
focal_class.full_signature: @Override public void activateTask(@NonNull Task task)
focal_class.identifier: activateTask
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull Task task)
focal_class.return: void
focal_class.signature: void activateTask(@NonNull Task task)
focal_class.class_method_signature: TasksRepository.activateTask(@NonNull String taskId)
focal_class.full_signature: @Override public void activateTask(@NonNull String taskId)
focal_class.identifier: activateTask
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull String taskId)
focal_class.return: void
focal_class.signature: void activateTask(@NonNull String taskId)
focal_class.class_method_signature: TasksRepository.clearCompletedTasks()
focal_class.full_signature: @Override public void clearCompletedTasks()
focal_class.identifier: clearCompletedTasks
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clearCompletedTasks()
focal_class.class_method_signature: TasksRepository.getTask(@NonNull final String taskId)
focal_class.full_signature: @Override public Flowable<Optional<Task>> getTask(@NonNull final String taskId)
focal_class.identifier: getTask
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull final String taskId)
focal_class.return: Flowable<Optional<Task>>
focal_class.signature: Flowable<Optional<Task>> getTask(@NonNull final String taskId)
focal_class.class_method_signature: TasksRepository.refreshTasks()
focal_class.full_signature: @Override public void refreshTasks()
focal_class.identifier: refreshTasks
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void refreshTasks()
focal_class.class_method_signature: TasksRepository.deleteAllTasks()
focal_class.full_signature: @Override public void deleteAllTasks()
focal_class.identifier: deleteAllTasks
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void deleteAllTasks()
focal_class.class_method_signature: TasksRepository.deleteTask(@NonNull String taskId)
focal_class.full_signature: @Override public void deleteTask(@NonNull String taskId)
focal_class.identifier: deleteTask
focal_class.modifiers: @Override public
focal_class.parameters: (@NonNull String taskId)
focal_class.return: void
focal_class.signature: void deleteTask(@NonNull String taskId)
focal_class.class_method_signature: TasksRepository.getTaskWithId(@NonNull String id)
focal_class.full_signature: @Nullable private Task getTaskWithId(@NonNull String id)
focal_class.identifier: getTaskWithId
focal_class.modifiers: @Nullable private
focal_class.parameters: (@NonNull String id)
focal_class.return: Task
focal_class.signature: Task getTaskWithId(@NonNull String id)
focal_class.class_method_signature: TasksRepository.getTaskWithIdFromLocalRepository(@NonNull final String taskId)
focal_class.full_signature: @NonNull Flowable<Optional<Task>> getTaskWithIdFromLocalRepository(@NonNull final String taskId)
focal_class.identifier: getTaskWithIdFromLocalRepository
focal_class.modifiers: @NonNull
focal_class.parameters: (@NonNull final String taskId)
focal_class.return: Flowable<Optional<Task>>
focal_class.signature: Flowable<Optional<Task>> getTaskWithIdFromLocalRepository(@NonNull final String taskId)
focal_method.body: @Override
      public void saveTask(@NonNull Task task) {
          checkNotNull(task);
          mTasksRemoteDataSource.saveTask(task);
          mTasksLocalDataSource.saveTask(task);
  
          // Do in memory cache update to keep the app UI up to date
          if (mCachedTasks == null) {
              mCachedTasks = new LinkedHashMap<>();
          }
          mCachedTasks.put(task.getId(), task);
      }
focal_method.class_method_signature: TasksRepository.saveTask(@NonNull Task task)
focal_method.full_signature: @Override public void saveTask(@NonNull Task task)
focal_method.identifier: saveTask
focal_method.invocations: checkNotNull saveTask saveTask put getId
focal_method.modifiers: @Override public
focal_method.parameters: (@NonNull Task task)
focal_method.return: void
focal_method.signature: void saveTask(@NonNull Task task)