### Question:
WorkContinuationImpl extends WorkContinuation implements SynchronousWorkContinuation { @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) public boolean hasCycles() { return hasCycles(this, new HashSet<String>()); } 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 @SmallTest public void testContinuation_hasNoCycles() { OneTimeWorkRequest aWork = createTestWorker(); OneTimeWorkRequest bWork = createTestWorker(); OneTimeWorkRequest cWork = createTestWorker(); WorkContinuation continuationAB = new WorkContinuationImpl( mWorkManagerImpl, Arrays.asList(aWork, bWork)); WorkContinuation continuationBC = new WorkContinuationImpl( mWorkManagerImpl, Arrays.asList(bWork, cWork)); WorkContinuationImpl joined = (WorkContinuationImpl) WorkContinuation.combine(continuationAB, continuationBC); assertThat(joined.hasCycles(), is(false)); }
@Test @SmallTest public void testContinuation_hasNoCycles3() { OneTimeWorkRequest aWork = createTestWorker(); OneTimeWorkRequest bWork = createTestWorker(); OneTimeWorkRequest cWork = createTestWorker(); WorkContinuation continuationA = new WorkContinuationImpl( mWorkManagerImpl, Collections.singletonList(aWork)); WorkContinuation continuationB = new WorkContinuationImpl( mWorkManagerImpl, Collections.singletonList(bWork)); WorkContinuation continuationC = new WorkContinuationImpl( mWorkManagerImpl, Collections.singletonList(cWork)); WorkContinuation first = WorkContinuation.combine(continuationA, continuationB); WorkContinuation second = WorkContinuation.combine(continuationA, continuationC); WorkContinuationImpl joined = (WorkContinuationImpl) WorkContinuation.combine( first, second); assertThat(joined.hasCycles(), is(false)); }