Refine search
@Override public void run() { assertThat(Thread.currentThread().isInterrupted()).isFalse(); } });
@Test public void hasCycle_emptyGraph() { assertThat(hasCycle(directedGraph)).isFalse(); assertThat(hasCycle(undirectedGraph)).isFalse(); }
@Test public void hasCycle_oneEdge() { for (MutableGraph<Integer> graph : graphsToTest) { graph.putEdge(1, 2); } assertThat(hasCycle(directedGraph)).isFalse(); assertThat(hasCycle(undirectedGraph)).isFalse(); }
@Override public void run() { assertThat(Thread.currentThread().isInterrupted()).isFalse(); } });
@Test public void recycle_doesNotRecycleWrappedBitmap() { resource.recycle(); assertThat(bitmap.isRecycled()).isFalse(); }
private static void assertCannotSet(AbstractFuture<Integer> future) { assertThat(future.set(99)).isFalse(); assertThat(future.setException(new IndexOutOfBoundsException())).isFalse(); assertThat(future.setFuture(new AbstractFuture<Integer>() {})).isFalse(); assertThat(future.setFuture(immediateFuture(99))).isFalse(); }
@Test public void addEdge_existingSelfLoopEdgeBetweenSameNodes() { putEdge(N1, N1); assertThat(putEdge(N1, N1)).isFalse(); }
private static void assertCannotCancel(AbstractFuture<Integer> future) { assertThat(future.cancel(true)).isFalse(); assertThat(future.cancel(false)).isFalse(); } }
@Test public void addEdge_existingEdgeBetweenSameNodes() { putEdge(N1, N2); assertThat(putEdge(N2, N1)).isFalse(); }
@GwtIncompatible // threads public void testSubmitAsync_asyncCallable_returnsInterruptedFuture() throws InterruptedException { assertThat(Thread.interrupted()).isFalse(); SettableFuture<Integer> cancelledFuture = SettableFuture.create(); cancelledFuture.cancel(true); assertThat(Thread.interrupted()).isFalse(); ListenableFuture<Integer> future = submitAsync(constantAsyncCallable(cancelledFuture), directExecutor()); assertThat(future.isDone()).isTrue(); assertThat(Thread.interrupted()).isFalse(); }
@Test public void addEdge_existingSelfLoopEdgeBetweenSameNodes() { putEdge(N1, N1); assertThat(putEdge(N1, N1)).isFalse(); }
public void testToString() { Future<?> first = serializer.submitAsync(firstCallable, directExecutor()); TestCallable secondCallable = new TestCallable(SettableFuture.<Void>create()); Future<?> second = serializer.submitAsync(secondCallable, directExecutor()); assertThat(secondCallable.called).isFalse(); assertThat(second.toString()).contains(secondCallable.toString()); firstFuture.set(null); assertThat(second.toString()).contains(secondCallable.future.toString()); }
@Test public void hasCycle_isolatedNodes() { for (MutableGraph<Integer> graph : graphsToTest) { graph.addNode(1); graph.addNode(2); } assertThat(hasCycle(directedGraph)).isFalse(); assertThat(hasCycle(undirectedGraph)).isFalse(); }
@GwtIncompatible // threads public void testWhenAllComplete_noLeakInterruption() throws Exception { final SettableFuture<String> stringFuture = SettableFuture.create(); AsyncCallable<String> combiner = new AsyncCallable<String>() { @Override public ListenableFuture<String> call() throws Exception { return stringFuture; } }; ListenableFuture<String> futureResult = whenAllComplete().callAsync(combiner, directExecutor()); assertThat(Thread.interrupted()).isFalse(); futureResult.cancel(true); assertThat(Thread.interrupted()).isFalse(); }
@Test public void hasCycle_twoAcyclicEdges() { for (MutableGraph<Integer> graph : graphsToTest) { graph.putEdge(1, 2); graph.putEdge(1, 3); } assertThat(hasCycle(directedGraph)).isFalse(); assertThat(hasCycle(undirectedGraph)).isFalse(); }
public void testCancellationDoesNotViolateSerialization() { @SuppressWarnings({"unused", "nullness"}) Future<?> possiblyIgnoredError = serializer.submitAsync(firstCallable, directExecutor()); TestCallable secondCallable = new TestCallable(Futures.<Void>immediateFuture(null)); ListenableFuture<Void> secondFuture = serializer.submitAsync(secondCallable, directExecutor()); TestCallable thirdCallable = new TestCallable(Futures.<Void>immediateFuture(null)); @SuppressWarnings({"unused", "nullness"}) Future<?> possiblyIgnoredError1 = serializer.submitAsync(thirdCallable, directExecutor()); secondFuture.cancel(true); assertThat(secondCallable.called).isFalse(); assertThat(thirdCallable.called).isFalse(); firstFuture.set(null); assertThat(secondCallable.called).isFalse(); assertThat(thirdCallable.called).isTrue(); }
@Test public void clearRemoveAndRecycle_withUnTrackedRequest_doesNothingAndReturnsFalse() { FakeRequest request = new FakeRequest(); assertThat(tracker.clearRemoveAndRecycle(request)).isFalse(); assertThat(request.isCleared()).isFalse(); assertThat(request.isRecycled()).isFalse(); }
public void testTrustedGetFailure_NotCompleted() { SettableFuture<String> future = SettableFuture.create(); assertThat(future.isDone()).isFalse(); assertThat(future.tryInternalFastPathGetFailure()).isNull(); }
@Test public void isAnyResourceSet_errorSet_notFailedPrimary_nullParent_returnsFalse() { when(error.isResourceSet()).thenReturn(true); assertThat(coordinator.isAnyResourceSet()).isFalse(); }
public void testNewProxy_goodMethodWithNotEnoughTime() throws Exception { SampleImpl target = new SampleImpl(9999); Sample proxy = service.newProxy(target, Sample.class, NOT_ENOUGH_MS, MILLISECONDS); Stopwatch stopwatch = Stopwatch.createStarted(); try { proxy.sleepThenReturnInput("x"); fail("no exception thrown"); } catch (UncheckedTimeoutException expected) { } assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2)); // Is it still computing away anyway? assertThat(target.finished).isFalse(); MILLISECONDS.sleep(ENOUGH_MS); assertThat(target.finished).isFalse(); }