package org.raddatz.familienarchiv.geschichte;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import java.util.UUID;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
class GeschichteQueryServiceTest {

    @Mock
    GeschichteRepository geschichteRepository;

    @InjectMocks
    GeschichteQueryService geschichteQueryService;

    @Test
    void existsById_returns_true_when_geschichte_exists() {
        UUID id = UUID.randomUUID();
        when(geschichteRepository.existsById(id)).thenReturn(true);

        assertThat(geschichteQueryService.existsById(id)).isTrue();
    }

    @Test
    void existsById_returns_false_when_geschichte_does_not_exist() {
        UUID id = UUID.randomUUID();
        when(geschichteRepository.existsById(id)).thenReturn(false);

        assertThat(geschichteQueryService.existsById(id)).isFalse();
    }
}
