@Test
public void initMetadata_throwsException_whenReadConsistencyEnabledAndGenerationIsNull()
    throws IOException {

  Storage storage = new Storage(HTTP_TRANSPORT, JSON_FACTORY, r -> {});
  GoogleCloudStorageReadOptions options = newLazyReadOptionsBuilder().build();
  GoogleCloudStorageReadChannel readChannel = createReadChannel(storage, options);
  IllegalStateException e =
      assertThrows(
          IllegalStateException.class,
          () ->
              readChannel.initMetadata("gzip", /* sizeFromMetadata= */ 1, UNKNOWN_GENERATION_ID));
  assertThat(e).hasMessageThat().contains("Generation parameter of -1 is invalid");
}