Skip to content

Commit

Permalink
Fix Azure Core Amqp Sample issue #18806 by lihong 202105271344 (#21885)
Browse files Browse the repository at this point in the history
  • Loading branch information
v-hongli1 authored Jun 9, 2021
1 parent 32e065c commit 150f65b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@

package com.azure.core.amqp.models;

import org.junit.jupiter.api.Test;
import java.nio.charset.StandardCharsets;

/**
* Class contains sample code snippets that will be used in javadocs.
*/
public class AmqpAnnotatedMessageJavaDocCodeSamples {
/**
* Get message body from {@link AmqpAnnotatedMessage}.
*/
@Test
public void checkBodyType() {
AmqpAnnotatedMessage amqpAnnotatedMessage = null;
AmqpAnnotatedMessage amqpAnnotatedMessage =
new AmqpAnnotatedMessage(AmqpMessageBody.fromData("my-amqp-message".getBytes(StandardCharsets.UTF_8)));
// BEGIN: com.azure.core.amqp.models.AmqpBodyType.checkBodyType
// If client do not check `AmqpMessageBody.getBodyType()` and payload is not of type `AmqpMessageBodyType.DATA`,
// calling `getFirstData()` or `getData()` on `AmqpMessageBody` will throw Runtime exception.
Expand Down

0 comments on commit 150f65b

Please sign in to comment.