From 9ceba84b5b9d85c53f4a75bd633675b1852eff4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=85=E6=88=BF?= Date: Sun, 18 Jan 2026 12:59:28 +0800 Subject: [PATCH] refactor: Complete updateParticipantCheckInStatus delegation to ScheduleStatusService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 3 Complete: - Update MartialScheduleServiceImpl.updateParticipantCheckInStatus to delegate - Reduce method from 17 lines to 3 lines (delegation only) - Add 5 comprehensive unit tests for updateParticipantCheckInStatus - All tests passing (482 total: 477 existing + 5 new) Delegation Status: ✅ exportSchedule - FULLY DELEGATED ✅ exportScheduleTemplate2 - FULLY DELEGATED ✅ updateParticipantCheckInStatus - FULLY DELEGATED (NEW) Progress: 3/10 methods (30%) Remaining: 7 methods to delegate Next: Phase 4 - Dispatch Service methods (saveDispatch, adjustOrder, getDispatchData, moveScheduleGroup) --- .../buckets/.bloomcycle.bin/xl.meta | Bin 743 -> 743 bytes .../buckets/.usage-cache.bin.bkp/xl.meta | Bin 637 -> 630 bytes .../buckets/.usage-cache.bin/xl.meta | Bin 637 -> 630 bytes .../.minio.sys/buckets/.usage.json/xl.meta | Bin 2360 -> 2360 bytes .../.usage-cache.bin.bkp/xl.meta | Bin 636 -> 627 bytes .../000000-assets/.usage-cache.bin/xl.meta | Bin 636 -> 627 bytes .../assets/.usage-cache.bin.bkp/xl.meta | Bin 575 -> 575 bytes .../buckets/assets/.usage-cache.bin/xl.meta | Bin 575 -> 575 bytes .../impl/MartialScheduleServiceImpl.java | 17 +-- .../impl/MartialScheduleServiceImplTest.java | 105 +++++++++++++----- 10 files changed, 80 insertions(+), 42 deletions(-) diff --git a/minio_data/.minio.sys/buckets/.bloomcycle.bin/xl.meta b/minio_data/.minio.sys/buckets/.bloomcycle.bin/xl.meta index 8c7dfb52bf978fd0691e116c243990ec1dbb7230..6e532fd8cc060f11b7dc23624dc21c85736a9e54 100644 GIT binary patch delta 293 zcmaFP`kZxwCUSit{)h}6eZ9&vr#4lk`_8?7gnH?V@0O#EXb zXONPdmYim3W^QJXW@>DbYHVa|V49j{Vqs#OnqoRRjM1Q8CUDPs#>ORir8zlA8G{3Q zYT0>MbDB=SDywztozS-L)Q+RI)7=w(Ofo7Hi4prB;-j zE$>=hT#{H+lA3ayhZUqEGbf{+^~KR^>yj&zb5fo2a|?1(fwFfP1mFr%nT41xP7Yw2 r?hO}8pU$orFcZPO%q|-23g>30M{vE_Q|hN9xb5r)yVe2#g|TP@ delta 279 zcmaFP`kZxwCb#)EuUjjRuuKz~(?8L~SRjULw%*%buZuf2E`OD~bA#~2@&;D0l8Jw8 z51})2zON)w9^GX<&JY~o9*fuJ_PqT+h%#2$=?~50sybEX4C)x 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 3a2fb88447ed4971318d1ecebb7a1170a2818c4d..386c071fd2d940b7a041ee6f0c903e3acbc7a14a 100644 GIT binary patch delta 345 zcmey%@{MJJCUKl@on|fKIdl%S{iGPxkO_NLwjnj-R5-pPwQxj9n6HN?L zOjFEEEDVe-jm*-_7M7h$Pdd$T?)tM8^^A>6@=9}Zjyx_=HU4v!U1Pn%g*nCtrnUL! z)lBhE;1GbSu5u3}h}U(B$m zte9bON-mHnt}31lGGS3!#&m{-$%hu|gA`6$YXAniml#`PJ%Bpon3%XZ7}({w7#7HI hC~zJ9<=DfZkaD1tW0}Mrj+@(gs?N`m)SvX}FaQF!iaY=S delta 352 zcmeyy@|R_TCb#)E&HQ^uSgxI%FEr7_SYYP%!b5SNybJp8waojgKRIY(d7S#GRRM`b zC62+FRjI`jFEX530%8H_rM@AVxv7^Wx_5yMnfNCuIVH(7IW^fJ(a^*=+1$d+BH1|2 z$RyD+EycpZG}+w1aADcG^rX`a=Mw+fY-DU)l2@9ObL7=&p%nk86N_)2JJ^3FzN{s~ zLbE@z?BkxVbKTxHT-NqJ$f2=S|E~*!D8p4&1{SW#2N|X6TUPlb7MFw;q$HN49_L|Y z0D{b%^k}x7|BP1$XJ;08q$cKM=A|E6>YSLIk=nf001R{!i;GiBiaQo1XG~aBTy=@D zHP&NMezDx5vSNnCDY-zRxT<(I0}~TB2Ln6E%td7x)8#-628M;nhZgFCbWU2fs93p* m0jQ6Gfs>)q^uh*q_X3754ZJnXekC=nJkwdYgZ_NuvH$=zD2o|tH2EKqv++QSPL9vfO53`4T!HLRXk9;beIRX}1< ziDPhPRci6XiwuXCfLK6!sc%STZt7);?pUG%`ywn;gNYXPx)?t`cM8lDyKKoFk7*RE__fW!G4*aAA(|foX02c{Nk~ zllW{iHmow5R50JVoI_)){$CdcQHHs!3@MzG4>C&CcdqhDEG`KxNJ%V7JwIrD5M zvX6Vd&UJg+a9P{?Acw|Q{l6{@q6}AA8CbX`A7qrOZ&~G&SX>fXkdj!EdYp%q0SGd4 z(xcgS{xe=3oSj+Vk(!v3nU{WOsdHj-Mr!j~12E7{EG|whDehR5oH1chan&Wp)>w~4 z`NeXJ%8D5lr{n^O;;Q1=3`|Vi91QFrGZ&R*OqT;O7#J2NA6lpn(m83_qGIJL2B1C$ i22O@b(+eBe-3u7LH1O6i`<2wR@=Ryp4*K(r%K`v0#fL-y diff --git a/minio_data/.minio.sys/buckets/.usage.json/xl.meta b/minio_data/.minio.sys/buckets/.usage.json/xl.meta index 4d248ec7d52bbb683e5b0bc98b5aba67c834015d..0c0288d3d0d3c21698c8711cb4f5b6756ca45aea 100644 GIT binary patch delta 158 zcmV;P0Ac^Q61WnODGPm%<6rE=1ZxJx_mMO+5WD}24$~PzNvc}?^&92^G?90J1$~d> zU+j_mJRo6ZGh#A0H(_NoH8(J2Vr6AzH#0IaGcYh_H#9S3I60G80VXbk`rvc{fuwGA zY;45`tUAVl*McR%t=ou{u^Lw-q~$OvD;ZAnG64P0X$UEH+>@*U9u7DDr5Wi~lDGGaI|HaB55Wi>E0W;9`CHZwS6F*1`_0VXa*|Cay(fuw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ys/buckets/assets/.usage-cache.bin/xl.meta b/minio_data/.minio.sys/buckets/assets/.usage-cache.bin/xl.meta index 1ea24cca113507ab3e2b2df751e2d5a62b76fb17..13fffdf44b4fa32a59c1aeca77994fad3fb3d914 100644 GIT binary patch delta 174 zcmdnbvY%ywCU~=eDvl8CqJ26o#!^Oynz+0Wa1wi z1-KWDq4yW4a(254b1llcKc1k|J|@TBEN0{{R3 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); + } }