func TestGetNullNextLinkNamePages(t *testing.T) {
	client := newPagingClient()
	resp, err := client.GetNullNextLinkNamePages(context.Background(), nil)
	if err != nil {
		t.Fatal(err)
	}
	if len(resp.ProductResult.Values) == 0 {
		t.Fatal("missing payload")
	}
}
GetNullNextLinkNamePages - A paging operation that must ignore any kind of nextLink, and stop after page 1.
package paginggroup
import (
	"context"
	"net/http"
	"net/http/cookiejar"
	"reflect"
	"testing"
	"time"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore"
	"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
	"github.com/google/go-cmp/cmp"
)
func newPagingClient() *PagingClient {
	options := azcore.ClientOptions{}
	options.Retry.RetryDelay = 10 * time.Millisecond
	options.Transport = httpClientWithCookieJar()
	return NewPagingClient(NewDefaultConnection(&options))
}
func httpClientWithCookieJar() policy.Transporter {
	j, err := cookiejar.New(nil)
	if err != nil {
		panic(err)
	}
	http.DefaultClient.Jar = j
	return http.DefaultClient
}
func TestGetMultiplePages(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePages(nil)
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err := page.Err(); err != nil {
		t.Fatal(err)
	}
	if r := cmp.Diff(count, 10); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetMultiplePagesFailure(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePagesFailure(nil)
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if page.Err() == nil {
		t.Fatal("unexpected nil error")
	}
	if r := cmp.Diff(count, 1); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetMultiplePagesFailureURI(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePagesFailureURI(nil)
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if page.Err() == nil {
		t.Fatal("unexpected nil error")
	}
	if r := cmp.Diff(count, 1); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetMultiplePagesFragmentNextLink(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePagesFragmentNextLink("1.6", "test_user", nil)
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ODataProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err := page.Err(); err != nil {
		t.Fatal(err)
	}
	if r := cmp.Diff(count, 10); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetMultiplePagesFragmentWithGroupingNextLink(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePagesFragmentWithGroupingNextLink(CustomParameterGroup{
		APIVersion: "1.6",
		Tenant:     "test_user",
	})
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ODataProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err := page.Err(); err != nil {
		t.Fatal(err)
	}
	if r := cmp.Diff(count, 10); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetMultiplePagesLro(t *testing.T) {
	client := newPagingClient()
	resp, err := client.BeginGetMultiplePagesLRO(context.Background(), nil)
	if err != nil {
		t.Fatal(err)
	}
	poller := resp.Poller
	rt, err := poller.ResumeToken()
	if err != nil {
		t.Fatal(err)
	}
	resp = PagingGetMultiplePagesLROPollerResponse{}
	if err = resp.Resume(context.Background(), client, rt); err != nil {
		t.Fatal(err)
	}
	pager, err := resp.PollUntilDone(context.Background(), 1*time.Millisecond)
	if err != nil {
		t.Fatal(err)
	}
	count := 0
	for pager.NextPage(context.Background()) {
		resp := pager.PageResponse()
		if len(resp.ProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err = pager.Err(); err != nil {
		t.Fatal(err)
	}
	const pageCount = 10
	if r := cmp.Diff(count, pageCount); r != "" {
		t.Fatal(r)
	}
}
func TestGetMultiplePagesRetryFirst(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePagesRetryFirst(nil)
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err := page.Err(); err != nil {
		t.Fatal(err)
	}
	if r := cmp.Diff(count, 10); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetMultiplePagesRetrySecond(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePagesRetrySecond(nil)
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err := page.Err(); err != nil {
		t.Fatal(err)
	}
	if r := cmp.Diff(count, 10); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetMultiplePagesWithOffset(t *testing.T) {
	client := newPagingClient()
	page := client.GetMultiplePagesWithOffset(PagingGetMultiplePagesWithOffsetOptions{})
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ProductResult.Values) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err := page.Err(); err != nil {
		t.Fatal(err)
	}
	if r := cmp.Diff(count, 10); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}
func TestGetNoItemNamePages(t *testing.T) {
	client := newPagingClient()
	page := client.GetNoItemNamePages(nil)
	count := 0
	for page.NextPage(context.Background()) {
		resp := page.PageResponse()
		if len(resp.ProductResultValue.Value) == 0 {
			t.Fatal("missing payload")
		}
		count++
	}
	if err := page.Err(); err != nil {
		t.Fatal(err)
	}
	if r := cmp.Diff(count, 1); r != "" {
		t.Fatal(r)
	}
	if reflect.ValueOf(page.PageResponse()).IsZero() {
		t.Fatal("unexpected empty payload")
	}
}