package com.vaessl.app.connection;

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

import org.junit.jupiter.api.Test;

import com.vaessl.app.dto.ConnectionRequest;
import com.vaessl.app.exception.EmptyCredentialsException;

import static org.assertj.core.api.Assertions.assertThat;
import static com.vaessl.app.connection.Mockdata.*;

class HomeBoxConnectionProviderTest {

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

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

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

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