PendingTaskCollectionPointer { synchronized void setToOverwrite(final Collection<Task> newCollection) { this.curTaskCollection = newCollection; } @Inject private  PendingTaskCollectionPointer(); static PendingTaskCollectionPointer newInstance();  }
@Test public void setToOverwrite() { final List<Task> taskList1 = mockTaskList(); pendingTaskCollectionPointer.setIfNull(taskList1); final List<Task> taskList2 = mockTaskList(); pendingTaskCollectionPointer.setToOverwrite(taskList2); final Optional<Collection<Task>> optional = pendingTaskCollectionPointer.getAndSetNull(); assertTrue(optional.isPresent()); assertEquals(taskList2, optional.get()); }