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

package com.azure.ai.anomalydetector.generated;

import com.azure.ai.anomalydetector.AnomalyDetectorClient;
import com.azure.ai.anomalydetector.AnomalyDetectorClientBuilder;
import com.azure.core.http.HttpClient;
import com.azure.core.http.policy.HttpLogDetailLevel;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.test.TestBase;
import com.azure.core.test.TestMode;
import com.azure.core.util.Configuration;

class AnomalyDetectorClientTestBase extends TestBase {
    protected AnomalyDetectorClient anomalyDetectorClient;

    @Override
    protected void beforeTest() {
        AnomalyDetectorClientBuilder anomalyDetectorClientbuilder =
                new AnomalyDetectorClientBuilder()
                        .endpoint(Configuration.getGlobalConfiguration().get("ENDPOINT", "endpoint"))
                        .httpClient(HttpClient.createDefault())
                        .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BASIC));
        if (getTestMode() == TestMode.PLAYBACK) {
            anomalyDetectorClientbuilder.httpClient(interceptorManager.getPlaybackClient());
        } else if (getTestMode() == TestMode.RECORD) {
            anomalyDetectorClientbuilder.addPolicy(interceptorManager.getRecordPolicy());
        }
        anomalyDetectorClient = anomalyDetectorClientbuilder.buildClient();
    }
}
