Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.util.concurrent.Futures.getDone;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static com.google.common.util.concurrent.Runnables.doNothing;
import static com.google.common.util.concurrent.TestPlatform.getDoneFromTimeoutOverload;
import static com.google.common.util.concurrent.TestPlatform.verifyGetOnPendingFuture;
import static com.google.common.util.concurrent.TestPlatform.verifyTimedGetOnPendingFuture;
Expand Down Expand Up @@ -326,7 +325,7 @@ public void testNullListener() {

@SuppressWarnings("nullness") // test of a bogus call
public void testNullExecutor() {
assertThrows(NullPointerException.class, () -> future.addListener(doNothing(), null));
assertThrows(NullPointerException.class, () -> future.addListener(() -> {}, null));
}

@SuppressWarnings("nullness") // test of a bogus call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testCallUninterruptiblyWithTimeout_propagatesReturnValue() throws Ex
}

public void testRunWithTimeout_returnsWithoutException() throws Exception {
timeLimiter.runWithTimeout(Runnables.doNothing(), DELAY_MS, MILLISECONDS);
timeLimiter.runWithTimeout(() -> {}, DELAY_MS, MILLISECONDS);
}

public void testRunWithTimeout_wrapsUncheckedException() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ public void execute(Runnable task) {
};
SequentialExecutor executor = new SequentialExecutor(delegate);
ExecutorService blocked = newCachedThreadPool();
Future<?> first = blocked.submit(() -> executor.execute(Runnables.doNothing()));
Future<?> first = blocked.submit(() -> executor.execute(() -> {}));
future.get(10, SECONDS);
assertThrows(RejectedExecutionException.class, () -> executor.execute(Runnables.doNothing()));
assertThrows(RejectedExecutionException.class, () -> executor.execute(() -> {}));
latch.countDown();
ExecutionException expected =
assertThrows(ExecutionException.class, () -> first.get(10, SECONDS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.collect.Iterables.all;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.common.util.concurrent.Runnables.doNothing;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;

Expand Down Expand Up @@ -72,22 +71,22 @@ public void testDelegations() throws InterruptedException {
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
testExecutor.execute(doNothing());
testExecutor.execute(() -> {});
mock.assertLastMethodCalled("execute");
}

public void testSubmit() throws InterruptedException, ExecutionException {
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<?> f = testExecutor.submit(doNothing());
Future<?> f = testExecutor.submit(() -> {});
mock.assertLastMethodCalled("submit");
f.get();
}
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<String> f = testExecutor.submit(doNothing(), RESULT_VALUE);
Future<String> f = testExecutor.submit(() -> {}, RESULT_VALUE);
mock.assertLastMethodCalled("submit");
assertThat(f.get()).isEqualTo(RESULT_VALUE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.util.concurrent.Futures.getDone;
import static com.google.common.util.concurrent.Futures.immediateFuture;
import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
import static com.google.common.util.concurrent.Runnables.doNothing;
import static com.google.common.util.concurrent.TestPlatform.getDoneFromTimeoutOverload;
import static com.google.common.util.concurrent.TestPlatform.verifyGetOnPendingFuture;
import static com.google.common.util.concurrent.TestPlatform.verifyTimedGetOnPendingFuture;
Expand Down Expand Up @@ -326,7 +325,7 @@ public void testNullListener() {

@SuppressWarnings("nullness") // test of a bogus call
public void testNullExecutor() {
assertThrows(NullPointerException.class, () -> future.addListener(doNothing(), null));
assertThrows(NullPointerException.class, () -> future.addListener(() -> {}, null));
}

@SuppressWarnings("nullness") // test of a bogus call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void testCallUninterruptiblyWithTimeout_propagatesReturnValue() throws Ex
}

public void testRunWithTimeout_returnsWithoutException() throws Exception {
timeLimiter.runWithTimeout(Runnables.doNothing(), DELAY_MS, MILLISECONDS);
timeLimiter.runWithTimeout(() -> {}, DELAY_MS, MILLISECONDS);
}

public void testRunWithTimeout_wrapsUncheckedException() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ public void execute(Runnable task) {
};
SequentialExecutor executor = new SequentialExecutor(delegate);
ExecutorService blocked = newCachedThreadPool();
Future<?> first = blocked.submit(() -> executor.execute(Runnables.doNothing()));
Future<?> first = blocked.submit(() -> executor.execute(() -> {}));
future.get(10, SECONDS);
assertThrows(RejectedExecutionException.class, () -> executor.execute(Runnables.doNothing()));
assertThrows(RejectedExecutionException.class, () -> executor.execute(() -> {}));
latch.countDown();
ExecutionException expected =
assertThrows(ExecutionException.class, () -> first.get(10, SECONDS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static com.google.common.collect.Iterables.all;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
import static com.google.common.util.concurrent.Runnables.doNothing;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;

Expand Down Expand Up @@ -72,22 +71,22 @@ public void testDelegations() throws InterruptedException {
public void testExecute() {
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
testExecutor.execute(doNothing());
testExecutor.execute(() -> {});
mock.assertLastMethodCalled("execute");
}

public void testSubmit() throws InterruptedException, ExecutionException {
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<?> f = testExecutor.submit(doNothing());
Future<?> f = testExecutor.submit(() -> {});
mock.assertLastMethodCalled("submit");
f.get();
}
{
MockExecutor mock = new MockExecutor();
TestExecutor testExecutor = new TestExecutor(mock);
Future<String> f = testExecutor.submit(doNothing(), RESULT_VALUE);
Future<String> f = testExecutor.submit(() -> {}, RESULT_VALUE);
mock.assertLastMethodCalled("submit");
assertThat(f.get()).isEqualTo(RESULT_VALUE);
}
Expand Down
Loading