### Question:
WorkContinuationImpl extends WorkContinuation implements SynchronousWorkContinuation { @Override @WorkerThread public void enqueueSync() { if (Looper.getMainLooper().getThread() == Thread.currentThread()) { throw new IllegalStateException("Cannot enqueueSync on main thread!"); } if (!mEnqueued) { new EnqueueRunnable(this).run(); } else { Log.w(TAG, String.format("Already enqueued work ids (%s)", TextUtils.join(", ", mIds))); } } WorkContinuationImpl(
            @NonNull WorkManagerImpl workManagerImpl,
            @NonNull List<? extends WorkRequest> work);   WorkContinuationImpl(
            @NonNull WorkManagerImpl workManagerImpl,
            String name,
            ExistingWorkPolicy existingWorkPolicy,
            @NonNull List<? extends WorkRequest> work);   WorkContinuationImpl(@NonNull WorkManagerImpl workManagerImpl,
            String name,
            ExistingWorkPolicy existingWorkPolicy,
            @NonNull List<? extends WorkRequest> work,
            @Nullable List<WorkContinuationImpl> parents); @NonNull WorkManagerImpl getWorkManagerImpl(); @Nullable String getName(); ExistingWorkPolicy getExistingWorkPolicy(); @NonNull List<? extends WorkRequest> getWork(); @NonNull List<String> getIds(); List<String> getAllIds(); boolean isEnqueued(); void markEnqueued(); List<WorkContinuationImpl> getParents(); @Override WorkContinuation then(List<OneTimeWorkRequest> work); @Override LiveData<List<WorkStatus>> getStatuses(); @Override List<WorkStatus> getStatusesSync(); @Override void enqueue(); @Override @WorkerThread void enqueueSync(); @Override SynchronousWorkContinuation synchronous(); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) boolean hasCycles(); @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) static Set<String> prerequisitesFor(WorkContinuationImpl continuation);  }### Answer:
@Test public void testContinuation_joinAndEnqueue() { WorkContinuationImpl first = new WorkContinuationImpl(mWorkManagerImpl, createTestWorkerList()); WorkContinuationImpl second = new WorkContinuationImpl(mWorkManagerImpl, createTestWorkerList()); WorkContinuationImpl third = new WorkContinuationImpl(mWorkManagerImpl, createTestWorkerList()); WorkContinuationImpl fourth = new WorkContinuationImpl(mWorkManagerImpl, createTestWorkerList()); WorkContinuationImpl firstDependent = (WorkContinuationImpl) WorkContinuation.combine( first, second); WorkContinuationImpl secondDependent = (WorkContinuationImpl) WorkContinuation.combine( third, fourth); WorkContinuationImpl dependent = (WorkContinuationImpl) WorkContinuation.combine( firstDependent, secondDependent); dependent.enqueueSync(); verifyEnqueued(dependent); verifyScheduled(mScheduler, dependent); }
@Test public void testContinuation_joinAndEnqueueWithOverlaps() { WorkContinuationImpl first = new WorkContinuationImpl(mWorkManagerImpl, createTestWorkerList()); WorkContinuationImpl second = new WorkContinuationImpl(mWorkManagerImpl, createTestWorkerList()); WorkContinuationImpl third = new WorkContinuationImpl(mWorkManagerImpl, createTestWorkerList()); WorkContinuationImpl firstDependent = (WorkContinuationImpl) WorkContinuation.combine( first, second); WorkContinuationImpl secondDependent = (WorkContinuationImpl) WorkContinuation.combine( first, third); WorkContinuationImpl dependent = (WorkContinuationImpl) WorkContinuation.combine( firstDependent, secondDependent); dependent.enqueueSync(); verifyEnqueued(dependent); verifyScheduled(mScheduler, dependent); }