public static Read read() {
    return new AutoValue_RabbitMqIO_Read.Builder()
        .setQueueDeclare(false)
        .setExchangeDeclare(false)
        .setMaxReadTime(null)
        .setMaxNumRecords(Long.MAX_VALUE)
        .setUseCorrelationId(false)
        .build();
  }
@Test
  public void testDeclareIncompatibleExchangeFails() throws Exception {
    RabbitMqIO.Read read =
        RabbitMqIO.read().withExchange("IncompatibleExchange", "direct", "unused");
    try {
      doExchangeTest(new ExchangeTestPlan(read, 1), true);
      fail("Expected to have failed to declare an incompatible exchange");
    } catch (Exception e) {
      Throwable cause = Throwables.getRootCause(e);
      if (cause instanceof ShutdownSignalException) {
        ShutdownSignalException sse = (ShutdownSignalException) cause;
        Method reason = sse.getReason();
        if (reason instanceof com.rabbitmq.client.AMQP.Connection.Close) {
          com.rabbitmq.client.AMQP.Connection.Close close =
              (com.rabbitmq.client.AMQP.Connection.Close) reason;
          assertEquals("Expected failure is 530: not-allowed", 530, close.getReplyCode());
        } else {
          fail(
              "Unexpected ShutdownSignalException reason. Expected Connection.Close. Got: "
                  + reason);
        }
      } else {
        fail("Expected to fail with ShutdownSignalException. Instead failed with " + cause);
      }
    }
  }