package at.procon.eventhub.tachographfilesession.service;

import static org.assertj.core.api.Assertions.assertThat;

import java.time.LocalDate;
import org.junit.jupiter.api.Test;

class TachographTimeParserTest {

    @Test
    void combinesPlainLocalTimeAsUtc() {
        assertThat(TachographTimeParser.combineUtc(LocalDate.of(2026, 4, 1), "00:00:00"))
                .hasToString("2026-04-01T00:00Z");
    }

    @Test
    void preservesDateShiftWhenOffsetTimeCrossesUtcMidnight() {
        assertThat(TachographTimeParser.combineUtc(LocalDate.of(2026, 4, 1), "00:30:00+02:00"))
                .hasToString("2026-03-31T22:30Z");
    }

    @Test
    void returnsNullForInvalidTimeText() {
        assertThat(TachographTimeParser.combineUtc(LocalDate.of(2026, 4, 1), "not-a-time")).isNull();
    }
}
