package space.nstart.pcp.pcp_request_service.service

import org.junit.jupiter.api.Test
import org.mockito.Mockito
import org.springframework.test.util.ReflectionTestUtils
import space.nstart.pcp.pcp_request_service.repository.PDCMRepository
import java.time.LocalDateTime
import kotlin.test.assertEquals

class SatelliteServiceRvaTest {

    @Test
    fun `getRVA returns empty list when no orbital points exist for interval`() {
        val service = SatelliteService()
        val pdcmRepository = Mockito.mock(PDCMRepository::class.java)
        val timeStart = LocalDateTime.parse("2026-05-26T10:00:00")
        val timeStop = LocalDateTime.parse("2026-05-26T13:00:00")

        Mockito.`when`(pdcmRepository.findBySatelliteIdAndTimeBetween(SATELLITE_ID, timeStart, timeStop))
            .thenReturn(emptyList())

        ReflectionTestUtils.setField(service, "pdcmRepository", pdcmRepository)

        assertEquals(emptyList(), service.getRVA(SATELLITE_ID, timeStart, timeStop))
    }

    private companion object {
        const val SATELLITE_ID = 56756L
    }
}
