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