package com.vaessl.app.connection;

import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.Test;

import com.vaessl.app.exception.EmptyCredentialsException;
import static com.vaessl.app.Mockdata.*;
import static com.vaessl.app.shared.ServiceType.HOMEBOX;
import static org.assertj.core.api.Assertions.assertThat;

class HomeboxConnectionProviderTest {

    private final HomeboxConnectionProvider provider = new HomeboxConnectionProvider(null, null);

    @Test
    void checkCredentialsShouldThrowExceptionWhenFieldsAreMissing() {
        ConnectionRequest request = new ConnectionRequest(MOCK_URL, HOMEBOX, null, null, false);

        EmptyCredentialsException exception = assertThrows(EmptyCredentialsException.class, () -> {
            provider.checkCredentials(request);
        });

        assertThat(exception.getMissingFields()).containsExactly("username", "password");
    }
}
