package com.njcn.gather.tool.adddata.component;

import com.njcn.gather.tool.adddata.pojo.bo.AddDataTaskCommand;
import com.njcn.gather.tool.adddata.pojo.vo.AddDataTaskStatusVO;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.time.LocalDateTime;
import java.util.Arrays;

/**
 * 补数任务状态持有器测试。
 */
class AddDataTaskStatusHolderTest {

    private final AddDataTaskStatusHolder holder = new AddDataTaskStatusHolder(new AddDataTimeSlotCalculator());

    @Test
    void shouldReturnHourlyTimeResultsWhenCreateTask() {
        AddDataTaskCommand command = new AddDataTaskCommand(
                Arrays.asList("1"),
                LocalDateTime.of(2026, 4, 28, 10, 7, 0),
                LocalDateTime.of(2026, 4, 28, 13, 0, 0),
                5);

        AddDataTaskStatusVO status = holder.createWaitingTask(command);

        Assertions.assertEquals(Arrays.asList(
                "2026-04-28 11:00:00",
                "2026-04-28 12:00:00",
                "2026-04-28 13:00:00"), status.getHourlyTimeResults());
    }
}
