/*
 * Copyright 2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.webauthn4j.validator;


import com.webauthn4j.validator.attestation.trustworthiness.certpath.CertPathTrustworthinessValidator;
import com.webauthn4j.validator.attestation.trustworthiness.ecdaa.ECDAATrustworthinessValidator;
import com.webauthn4j.validator.attestation.trustworthiness.self.SelfAttestationTrustworthinessValidator;
import org.junit.jupiter.api.Test;

import java.util.Collections;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.mockito.Mockito.mock;

class WebAuthnRegistrationContextValidatorTest {

    private CertPathTrustworthinessValidator certPathTrustworthinessValidatorMock = mock(CertPathTrustworthinessValidator.class);
    private ECDAATrustworthinessValidator ecdaaTrustworthinessValidatorMock = mock(ECDAATrustworthinessValidator.class);
    private SelfAttestationTrustworthinessValidator selfAttestationTrustworthinessValidator = mock(SelfAttestationTrustworthinessValidator.class);


    @Test
    void constructor_test() {
        WebAuthnRegistrationContextValidator validator1 = new WebAuthnRegistrationContextValidator(
                Collections.emptyList(),
                certPathTrustworthinessValidatorMock,
                ecdaaTrustworthinessValidatorMock);

        WebAuthnRegistrationContextValidator validator2 = new WebAuthnRegistrationContextValidator(
                Collections.emptyList(),
                certPathTrustworthinessValidatorMock,
                ecdaaTrustworthinessValidatorMock);

        WebAuthnRegistrationContextValidator validator3 = new WebAuthnRegistrationContextValidator(
                Collections.emptyList(),
                certPathTrustworthinessValidatorMock,
                ecdaaTrustworthinessValidatorMock,
                selfAttestationTrustworthinessValidator);

        assertAll(
                () -> assertThat(validator1).hasFieldOrProperty("webAuthnManager").isNotNull(),
                () -> assertThat(validator2).hasFieldOrProperty("webAuthnManager").isNotNull(),
                () -> assertThat(validator3).hasFieldOrProperty("webAuthnManager").isNotNull()
        );
    }


}