AmqpMessage implements org.eclipse.microprofile.reactive.messaging.Message<T> { @Deprecated public static <T> AmqpMessageBuilder<T> builder() { return new AmqpMessageBuilder<>(); } AmqpMessage(io.vertx.mutiny.amqp.AmqpMessage delegate, Context context, AmqpFailureHandler onNack);  AmqpMessage(io.vertx.amqp.AmqpMessage msg, Context context, AmqpFailureHandler onNack); @Deprecated static AmqpMessageBuilder<T> builder(); @Override CompletionStage<Void> ack(); @Override CompletionStage<Void> nack(Throwable reason); @SuppressWarnings("unchecked") @Override T getPayload(); @Override Metadata getMetadata(); Message unwrap(); boolean isDurable(); long getDeliveryCount(); int getPriority(); long getTtl(); Object getMessageId(); long getGroupSequence(); long getCreationTime(); String getAddress(); String getGroupId(); String getContentType(); long getExpiryTime(); Object getCorrelationId(); String getContentEncoding(); String getSubject(); JsonObject getApplicationProperties(); Section getBody(); MessageError getError(); io.vertx.mutiny.amqp.AmqpMessage getAmqpMessage();  }
@SuppressWarnings("deprecation") @Test public void testBuilder() { AmqpMessageBuilder<String> builder = AmqpMessage.builder(); JsonObject json = new JsonObject(); json.put("hello", "world"); json.put("some", "content"); builder.withSubject("subject") .withTtl(1) .withDurable(true) .withReplyTo("reply") .withApplicationProperties(json) .withContentType("text/plain") .withContentEncoding("utf-8") .withCorrelationId("1234") .withGroupId("some-group") .withAddress("address") .withPriority((short) 2) .withBody("hello") .withId("4321"); AmqpMessage<String> msg = builder.build(); assertThat(msg.getAddress()).isEqualTo("address"); assertThat(msg.getApplicationProperties()).contains(entry("hello", "world"), entry("some", "content")); assertThat(msg.getContentType()).isEqualTo("text/plain"); assertThat(msg.getCreationTime()).isZero(); assertThat(msg.getDeliveryCount()).isZero(); assertThat(msg.getExpiryTime()).isZero(); assertThat(msg.getGroupId()).isEqualTo("some-group"); assertThat(msg.getTtl()).isEqualTo(1); assertThat(msg.getSubject()).isEqualTo("subject"); assertThat(msg.getPriority()).isEqualTo((short) 2); assertThat(((AmqpValue) msg.getBody()).getValue()).isEqualTo("hello"); assertThat(msg.getCorrelationId()).isEqualTo("1234"); assertThat(msg.getMessageId()).isEqualTo("4321"); assertThat(msg.isDurable()).isTrue(); assertThat(msg.getError().name()).isEqualTo("OK"); assertThat(msg.getGroupSequence()).isZero(); assertThat(AmqpMessage.<Boolean> builder().withBooleanAsBody(true).build().getPayload().booleanValue()).isTrue(); assertThat(AmqpMessage.<Integer> builder().withIntegerAsBody(23).build().getPayload()).isEqualTo(23); assertThat(AmqpMessage.<Long> builder().withLongAsBody(23L).build().getPayload()).isEqualTo(23L); }