package com.njcn.gather.aireport.reportapproval.pojo.vo;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Assert;
import org.junit.Test;

import java.time.LocalDateTime;

public class ReportApprovalVOTimeFormatTest {

    @Test
    public void pendingAndLogTimeJsonUseStandardTwentyFourHourFormat() throws Exception {
        ReportApprovalPendingVO pendingVO = new ReportApprovalPendingVO();
        pendingVO.setSubmitTime(LocalDateTime.of(2026, 6, 29, 10, 0, 0));
        ReportApprovalLogVO logVO = new ReportApprovalLogVO();
        logVO.setApprovalTime(LocalDateTime.of(2026, 6, 29, 18, 30, 45));

        ObjectMapper objectMapper = new ObjectMapper();
        String pendingJson = objectMapper.writeValueAsString(pendingVO);
        String logJson = objectMapper.writeValueAsString(logVO);

        Assert.assertTrue(pendingJson.contains("\"submitTime\":\"2026-06-29 10:00:00\""));
        Assert.assertFalse(pendingJson.contains("2026-06-29T10"));
        Assert.assertTrue(logJson.contains("\"approvalTime\":\"2026-06-29 18:30:45\""));
        Assert.assertFalse(logJson.contains("2026-06-29T18"));
    }
}
