@Test
public void testCompleted() throws Exception {

  OperationFuture<String, Integer> future =
      OperationFutures.<String, Integer>immediateOperationFuture(
          FakeOperationSnapshot.newBuilder()
              .setName("myName")
              .setDone(true)
              .setResponse("theResponse")
              .setMetadata(42)
              .setErrorCode(FakeStatusCode.of(StatusCode.Code.OK))
              .build());
  assertThat(future.getName()).isEqualTo("myName");
  assertThat(future.get()).isEqualTo("theResponse");
  assertThat(future.getMetadata().get()).isEqualTo(42);
}