You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: messageSettler_test.go
    path of file: ./repos/azure-sdk-for-go/sdk/messaging/azservicebus
    
    the code of the file until where you have to start completion: // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package azservicebus

import (
	"context"
	"testing"
	"time"

	"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
	"github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus/internal"
	"github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus/internal/test"
	"github.com/stretchr/testify/require"
)

func TestMessageSettlementUsingReceiver(t *testing.T) {
	testStuff := newTestStuff(t)
	defer testStuff.Close()

	receiver, deadLetterReceiver := testStuff.Receiver, testStuff.DeadLetterReceiver
	ctx := context.TODO()

	err := testStuff.Sender.SendMessage(context.Background(), &Message{
		Body: []byte("hello"),
	}, nil)
	require.NoError(t, err)

	messages, err := receiver.ReceiveMessages(ctx, 1, nil)
	require.NoError(t, err)
	require.EqualValues(t, 1, messages[0].DeliveryCount)

	// message from queue -> Abandon -> back to the queue
	err = receiver.AbandonMessage(context.Background(), messages[0], &AbandonMessageOptions{
		PropertiesToModify: map[string]any{
			"hello": "world",
		},
	})
	require.NoError(t, err)

	messages, err = receiver.ReceiveMessages(ctx, 1, nil)
	require.NoError(t, err
    
func TestDeferredMessages(t *testing.T) {
	ctx := context.TODO()

	testStuff := newTestStuff(t)
	defer testStuff.Close()

	receiver := testStuff.Receiver

	t.Run("Abandon", func(t *testing.T) {
		originalDeferredMessage := testStuff.deferMessageForTest(t)

		// abandoning the deferred message will increment its delivery count
		err := receiver.AbandonMessage(ctx, originalDeferredMessage, &AbandonMessageOptions{
			PropertiesToModify: map[string]any{
				"hello": "world",
			},
		})
		require.NoError(t, err)

		// we can peek it without altering anything here.
		peekedMessage := peekSingleMessageForTest(t, receiver)
		require.Equal(t, originalDeferredMessage.DeliveryCount+1, peekedMessage.DeliveryCount, "Delivery count is incremented")
	})

	t.Run("Complete", func(t *testing.T) {
		msg := testStuff.deferMessageForTest(t)

		err := receiver.CompleteMessage(ctx, msg, nil)
		require.NoError(t, err)

		assertEntityEmpty(t, receiver)
	})

	t.Run("Defer", func(t *testing.T) {
		msg := testStuff.deferMessageForTest(t)
		require.EqualValues(t, MessageStateDeferred, msg.State)

		peekedMsg := peekSingleMessageForTest(t, receiver)
		require.EqualValues(t, MessageStateDeferred, peekedMsg.State)

		// double defer!
		err := receiver.DeferMessage(ctx, msg, &DeferMessageOptions{
			PropertiesToModify: map[string]any{
				"hello": "world",
			},
		})
		require.NoError(t, err)

		deferredMessages, err := receiver.ReceiveDeferredMessages(ctx, []int64{*msg.SequenceNumber}, nil)
		require.NoError(t, err)

		require.EqualValues(t, "world", deferredMessages[0].ApplicationProperties["hello"].(string))

		err = receiver.CompleteMessage(ctx, deferredMessages[0], nil)
		require.NoError(t, err)

		assertEntityEmpty(t, receiver)
	})
}