// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.security.confidentialledger;

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.util.BinaryData;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class GetConsortiumMembersTests extends ConfidentialLedgerClientTestBase {
    @Test
    public void testGetConsortiumMembersTests() throws Exception {
        RequestOptions requestOptions = new RequestOptions();
        PagedIterable<BinaryData> pagedIterableResponse = confidentialLedgerClient.listConsortiumMembers(requestOptions);

        pagedIterableResponse.streamByPage().forEach(resp -> {
            Assertions.assertEquals(200, resp.getStatusCode());
            resp.getValue().forEach(item -> {

                ObjectMapper objectMapper = new ObjectMapper();
                JsonNode responseBodyJson = null;

                try {
                    responseBodyJson = objectMapper.readTree(item.toBytes());
                } catch (IOException e) {
                    e.printStackTrace();
                    Assertions.assertTrue(false);
                }

                Assertions.assertNotNull(responseBodyJson.get("id"));
            });
        });
    }
}
