package com.coupang.cgfs.retry.adapter.mysql.entity; import com.coupang.cgfs.retry.domain.enums.AdjustmentEventState; import com.coupang.cgfs.retry.domain.enums.AdjustmentType; import java.time.LocalDateTime; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class ProcessingEventEntityTest { @Test public void testBuilderAndGetters() { Long id = 1L; String requestId = "req1"; String eventId = "e1"; String financeEventId = "fe1"; Long parentProcessingEventId = 0L; AdjustmentType type = AdjustmentType.RETRY; // Use your actual enum constant AdjustmentEventState state = AdjustmentEventState.PENDING; // Use your actual enum constant LocalDateTime now = LocalDateTime.now(); String createdBy = "user1"; String updatedBy = "user1"; ProcessingEventEntity entity = ProcessingEventEntity.builder() .id(id) .requestId(requestId) .eventId(eventId) .financeEventId(financeEventId) .parentProcessingEventId(parentProcessingEventId) .type(type) .state(state) .createdAt(now) .updatedAt(now) .createdBy(createdBy) .updatedBy(updatedBy) .build(); assertEquals(id, entity.getId()); assertEquals(requestId, entity.getRequestId()); assertEquals(eventId, entity.getEventId()); assertEquals(financeEventId, entity.getFinanceEventId()); assertEquals(parentProcessingEventId, entity.getParentProcessingEventId()); assertEquals(type, entity.getType()); assertEquals(state, entity.getState()); assertEquals(now, entity.getCreatedAt()); assertEquals(now, entity.getUpdatedAt()); assertEquals(createdBy, entity.getCreatedBy()); assertEquals(updatedBy, entity.getUpdatedBy()); } } package com.coupang.cgfs.retry.adapter.mysql.mapper; import com.coupang.cgfs.retry.adapter.mysql.entity.ProcessingEventEntity; import com.coupang.cgfs.retry.domain.enums.AdjustmentEventState; import com.coupang.cgfs.retry.domain.enums.AdjustmentType; import com.coupang.cgfs.retry.domain.model.ProcessingEvent; import java.time.LocalDateTime; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class ProcessingEventMapperTest { @Test public void testMappingDomainToEntityAndBack() { LocalDateTime now = LocalDateTime.now(); // Create a fully populated domain object ProcessingEvent domain = ProcessingEvent.builder() .id(1L) .requestId("req1") .eventId("e1") .financeEventId("fe1") .parentProcessingEventId(0L) .type(AdjustmentType.RETRY) // Use your actual enum constant .state(AdjustmentEventState.PENDING) // Use your actual enum constant .createdBy("user1") .updatedBy("user1") .createdAt(now) .updatedAt(now) .build(); // Map to entity using the real mapper ProcessingEventEntity entity = ProcessingEventMapper.INSTANCE.toEntity(domain); // Map back to domain ProcessingEvent mappedBack = ProcessingEventMapper.INSTANCE.toDomain(entity); // Assert that key fields are equal assertEquals(domain.getId(), mappedBack.getId()); assertEquals(domain.getRequestId(), mappedBack.getRequestId()); assertEquals(domain.getEventId(), mappedBack.getEventId()); assertEquals(domain.getFinanceEventId(), mappedBack.getFinanceEventId()); assertEquals(domain.getParentProcessingEventId(), mappedBack.getParentProcessingEventId()); assertEquals(domain.getType(), mappedBack.getType()); assertEquals(domain.getState(), mappedBack.getState()); assertEquals(domain.getCreatedBy(), mappedBack.getCreatedBy()); assertEquals(domain.getUpdatedBy(), mappedBack.getUpdatedBy()); assertEquals(domain.getCreatedAt(), mappedBack.getCreatedAt()); assertEquals(domain.getUpdatedAt(), mappedBack.getUpdatedAt()); } }