diff --git a/minio_data/.minio.sys/buckets/.bloomcycle.bin/xl.meta b/minio_data/.minio.sys/buckets/.bloomcycle.bin/xl.meta index 8c7dfb5..6e532fd 100644 Binary files a/minio_data/.minio.sys/buckets/.bloomcycle.bin/xl.meta and b/minio_data/.minio.sys/buckets/.bloomcycle.bin/xl.meta differ diff --git a/minio_data/.minio.sys/buckets/.usage-cache.bin.bkp/xl.meta b/minio_data/.minio.sys/buckets/.usage-cache.bin.bkp/xl.meta index 3a2fb88..386c071 100644 Binary files a/minio_data/.minio.sys/buckets/.usage-cache.bin.bkp/xl.meta and b/minio_data/.minio.sys/buckets/.usage-cache.bin.bkp/xl.meta differ diff --git a/minio_data/.minio.sys/buckets/.usage-cache.bin/xl.meta b/minio_data/.minio.sys/buckets/.usage-cache.bin/xl.meta index b65f21b..56aa44b 100644 Binary files a/minio_data/.minio.sys/buckets/.usage-cache.bin/xl.meta and b/minio_data/.minio.sys/buckets/.usage-cache.bin/xl.meta differ diff --git a/minio_data/.minio.sys/buckets/.usage.json/xl.meta b/minio_data/.minio.sys/buckets/.usage.json/xl.meta index 4d248ec..0c0288d 100644 Binary files a/minio_data/.minio.sys/buckets/.usage.json/xl.meta and b/minio_data/.minio.sys/buckets/.usage.json/xl.meta differ diff --git a/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin.bkp/xl.meta b/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin.bkp/xl.meta index 8e40e2e..213831c 100644 Binary files a/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin.bkp/xl.meta and b/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin.bkp/xl.meta differ diff --git a/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin/xl.meta b/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin/xl.meta index 2ab6f79..f6ab057 100644 Binary files a/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin/xl.meta and b/minio_data/.minio.sys/buckets/000000-assets/.usage-cache.bin/xl.meta differ diff --git a/minio_data/.minio.sys/buckets/assets/.usage-cache.bin.bkp/xl.meta b/minio_data/.minio.sys/buckets/assets/.usage-cache.bin.bkp/xl.meta index 7f805e1..3b33275 100644 Binary files a/minio_data/.minio.sys/buckets/assets/.usage-cache.bin.bkp/xl.meta and b/minio_data/.minio.sys/buckets/assets/.usage-cache.bin.bkp/xl.meta differ diff --git a/minio_data/.minio.sys/buckets/assets/.usage-cache.bin/xl.meta b/minio_data/.minio.sys/buckets/assets/.usage-cache.bin/xl.meta index 1ea24cc..13fffdf 100644 Binary files a/minio_data/.minio.sys/buckets/assets/.usage-cache.bin/xl.meta and b/minio_data/.minio.sys/buckets/assets/.usage-cache.bin/xl.meta differ diff --git a/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java b/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java index dcc28aa..e5450f9 100644 --- a/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java +++ b/src/main/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImpl.java @@ -923,21 +923,8 @@ public class MartialScheduleServiceImpl extends ServiceImpl 0; + // Delegated to ScheduleStatusService + return scheduleStatusService.updateParticipantCheckInStatus(participantId, status); } diff --git a/src/test/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImplTest.java b/src/test/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImplTest.java index f4a0f49..40d3a7c 100644 --- a/src/test/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImplTest.java +++ b/src/test/java/org/springblade/modules/martial/service/impl/MartialScheduleServiceImplTest.java @@ -21,7 +21,9 @@ import static org.mockito.Mockito.*; * MartialScheduleServiceImpl Test * Following Google Testing Best Practices * - * Phase 2 Complete: exportSchedule and exportScheduleTemplate2 fully delegated + * Completed Phases: + * - Phase 2: Export Service (exportSchedule, exportScheduleTemplate2) + * - Phase 3: Status Service (updateParticipantCheckInStatus) */ @DisplayName("MartialScheduleServiceImpl - Delegation Tests") class MartialScheduleServiceImplTest { @@ -29,6 +31,9 @@ class MartialScheduleServiceImplTest { @Mock private IScheduleExportService scheduleExportService; + @Mock + private IScheduleStatusService scheduleStatusService; + @InjectMocks private MartialScheduleServiceImpl scheduleService; @@ -37,10 +42,11 @@ class MartialScheduleServiceImplTest { MockitoAnnotations.openMocks(this); } + // ========== Phase 2: Export Service Tests ========== + @Test @DisplayName("Should delegate exportSchedule to ScheduleExportService") void shouldDelegateExportScheduleToService() { - // Given Long competitionId = 1L; List expectedResult = Arrays.asList( new ScheduleExportExcel(), @@ -48,10 +54,8 @@ class MartialScheduleServiceImplTest { ); when(scheduleExportService.exportSchedule(competitionId)).thenReturn(expectedResult); - // When List result = scheduleService.exportSchedule(competitionId); - // Then assertNotNull(result); assertEquals(2, result.size()); verify(scheduleExportService).exportSchedule(competitionId); @@ -60,14 +64,11 @@ class MartialScheduleServiceImplTest { @Test @DisplayName("Should handle empty export result") void shouldHandleEmptyExportResult() { - // Given Long competitionId = 1L; when(scheduleExportService.exportSchedule(competitionId)).thenReturn(new ArrayList<>()); - // When List result = scheduleService.exportSchedule(competitionId); - // Then assertNotNull(result); assertTrue(result.isEmpty()); verify(scheduleExportService).exportSchedule(competitionId); @@ -76,13 +77,10 @@ class MartialScheduleServiceImplTest { @Test @DisplayName("Should handle null competition ID") void shouldHandleNullCompetitionId() { - // Given when(scheduleExportService.exportSchedule(null)).thenReturn(null); - // When List result = scheduleService.exportSchedule(null); - // Then assertNull(result); verify(scheduleExportService).exportSchedule(null); } @@ -90,24 +88,18 @@ class MartialScheduleServiceImplTest { @Test @DisplayName("Should verify exportSchedule is called exactly once") void shouldVerifyExportScheduleCalledOnce() { - // Given Long competitionId = 1L; when(scheduleExportService.exportSchedule(competitionId)).thenReturn(new ArrayList<>()); - // When scheduleService.exportSchedule(competitionId); - // Then verify(scheduleExportService, times(1)).exportSchedule(competitionId); verifyNoMoreInteractions(scheduleExportService); } - // ========== Phase 2: exportScheduleTemplate2 Tests ========== - @Test @DisplayName("Should delegate exportScheduleTemplate2 to ScheduleExportService") void shouldDelegateExportScheduleTemplate2ToService() { - // Given Long competitionId = 1L; Long venueId = 2L; List expectedResult = Arrays.asList( @@ -118,10 +110,8 @@ class MartialScheduleServiceImplTest { when(scheduleExportService.exportScheduleTemplate2(competitionId, venueId)) .thenReturn(expectedResult); - // When List result = scheduleService.exportScheduleTemplate2(competitionId, venueId); - // Then assertNotNull(result); assertEquals(3, result.size()); verify(scheduleExportService).exportScheduleTemplate2(competitionId, venueId); @@ -130,7 +120,6 @@ class MartialScheduleServiceImplTest { @Test @DisplayName("Should handle null venueId in exportScheduleTemplate2") void shouldHandleNullVenueIdInExportScheduleTemplate2() { - // Given Long competitionId = 1L; List expectedResult = Arrays.asList( new ScheduleExportExcel2() @@ -138,10 +127,8 @@ class MartialScheduleServiceImplTest { when(scheduleExportService.exportScheduleTemplate2(competitionId, null)) .thenReturn(expectedResult); - // When List result = scheduleService.exportScheduleTemplate2(competitionId, null); - // Then assertNotNull(result); assertEquals(1, result.size()); verify(scheduleExportService).exportScheduleTemplate2(competitionId, null); @@ -150,16 +137,13 @@ class MartialScheduleServiceImplTest { @Test @DisplayName("Should handle empty result in exportScheduleTemplate2") void shouldHandleEmptyResultInExportScheduleTemplate2() { - // Given Long competitionId = 1L; Long venueId = 2L; when(scheduleExportService.exportScheduleTemplate2(competitionId, venueId)) .thenReturn(new ArrayList<>()); - // When List result = scheduleService.exportScheduleTemplate2(competitionId, venueId); - // Then assertNotNull(result); assertTrue(result.isEmpty()); verify(scheduleExportService).exportScheduleTemplate2(competitionId, venueId); @@ -168,17 +152,84 @@ class MartialScheduleServiceImplTest { @Test @DisplayName("Should verify exportScheduleTemplate2 is called exactly once") void shouldVerifyExportScheduleTemplate2CalledOnce() { - // Given Long competitionId = 1L; Long venueId = 2L; when(scheduleExportService.exportScheduleTemplate2(competitionId, venueId)) .thenReturn(new ArrayList<>()); - // When scheduleService.exportScheduleTemplate2(competitionId, venueId); - // Then verify(scheduleExportService, times(1)).exportScheduleTemplate2(competitionId, venueId); verifyNoMoreInteractions(scheduleExportService); } + + // ========== Phase 3: Status Service Tests ========== + + @Test + @DisplayName("Should delegate updateParticipantCheckInStatus to ScheduleStatusService") + void shouldDelegateUpdateParticipantCheckInStatus() { + Long participantId = 1L; + String status = "CHECKED_IN"; + when(scheduleStatusService.updateParticipantCheckInStatus(participantId, status)) + .thenReturn(true); + + boolean result = scheduleService.updateParticipantCheckInStatus(participantId, status); + + assertTrue(result); + verify(scheduleStatusService).updateParticipantCheckInStatus(participantId, status); + } + + @Test + @DisplayName("Should handle null participantId in updateParticipantCheckInStatus") + void shouldHandleNullParticipantId() { + String status = "CHECKED_IN"; + when(scheduleStatusService.updateParticipantCheckInStatus(null, status)) + .thenReturn(false); + + boolean result = scheduleService.updateParticipantCheckInStatus(null, status); + + assertFalse(result); + verify(scheduleStatusService).updateParticipantCheckInStatus(null, status); + } + + @Test + @DisplayName("Should handle null status in updateParticipantCheckInStatus") + void shouldHandleNullStatus() { + Long participantId = 1L; + when(scheduleStatusService.updateParticipantCheckInStatus(participantId, null)) + .thenReturn(false); + + boolean result = scheduleService.updateParticipantCheckInStatus(participantId, null); + + assertFalse(result); + verify(scheduleStatusService).updateParticipantCheckInStatus(participantId, null); + } + + @Test + @DisplayName("Should handle update failure in updateParticipantCheckInStatus") + void shouldHandleUpdateFailure() { + Long participantId = 999L; + String status = "CHECKED_IN"; + when(scheduleStatusService.updateParticipantCheckInStatus(participantId, status)) + .thenReturn(false); + + boolean result = scheduleService.updateParticipantCheckInStatus(participantId, status); + + assertFalse(result); + verify(scheduleStatusService).updateParticipantCheckInStatus(participantId, status); + } + + @Test + @DisplayName("Should verify updateParticipantCheckInStatus is called exactly once") + void shouldVerifyUpdateParticipantCheckInStatusCalledOnce() { + Long participantId = 1L; + String status = "CHECKED_IN"; + when(scheduleStatusService.updateParticipantCheckInStatus(participantId, status)) + .thenReturn(true); + + scheduleService.updateParticipantCheckInStatus(participantId, status); + + verify(scheduleStatusService, times(1)).updateParticipantCheckInStatus(participantId, status); + verifyNoMoreInteractions(scheduleStatusService); + } }