@@ -54,10 +54,13 @@ void setUp() {
5454 mockSleeper = mock (Sleeper .class ); // both mock sleepers will be used for different methods.
5555 }
5656
57- @ Test
57+ /* 2025-11-20-EDIT: This file and DefaultHandlerTests.java is outdated, relying on the old project architecture
58+ before any of the refactoring related to ProcessingService.java */
59+
60+ /*@Test
5861 void failHandler_completes_failedTask() throws InterruptedException {
59- /* In my FailHandler.java class, I define successOdds as 0.25, so if I guarantee fixedRandom.nextDouble returns 0.1
60- (which obv <= 0.25, so I'm in the % interval where my random odds succeeded), then I can let failHandler complete this task: */
62+ In my FailHandler.java class, I define successOdds as 0.25, so if I guarantee fixedRandom.nextDouble returns 0.1
63+ (which obv <= 0.25, so I'm in the % interval where my random odds succeeded), then I can let failHandler complete this task:
6164 when(props.getFailSuccSleepTime()).thenReturn(2000L);
6265 when(fixedRandom.nextDouble()).thenReturn(0.1);
6366 FailHandler failHandler = new FailHandler(queue, fastSleeper, fixedRandom, props);
@@ -66,10 +69,10 @@ void failHandler_completes_failedTask() throws InterruptedException {
6669 // Assertions:
6770 assertEquals(TaskStatus.COMPLETED, t.getStatus());
6871 verify(queue, never()).retry(any(Task.class), anyInt());
69- }
72+ }*/
7073
7174 // This test case basically verifies that queue.retry(...) was called (when t.getAttempts() < t.getMaxRetries() and odds indicate no success).
72- @ Test
75+ /* @Test
7376 void failHandler_retries_failedTask() throws InterruptedException {
7477 when(props.getFailSleepTime()).thenReturn(1000L);
7578 when(fixedRandom.nextDouble()).thenReturn(0.9);
@@ -80,10 +83,10 @@ void failHandler_retries_failedTask() throws InterruptedException {
8083 failHandler.handle(t);
8184 assertEquals(TaskStatus.FAILED, t.getStatus());
8285 verify(queue, times(1)).retry(eq(t), eq(1000L));
83- }
86+ }*/
8487
8588 // This test case confirms that queue.retry(...) is not ran when (t.getAttempts >= t.getMaxRetries() and odds indicate no success).
86- @ Test
89+ /* @Test
8790 void failHandler_retires_maxFailedTask() throws InterruptedException {
8891 when(props.getFailSleepTime()).thenReturn(1000L);
8992 t.setAttempts(3); // So, it goes straight to the failed if-condition branch.
@@ -92,26 +95,26 @@ void failHandler_retires_maxFailedTask() throws InterruptedException {
9295 failHandler.handle(t);
9396 assertEquals(TaskStatus.FAILED, t.getStatus());
9497 verify(queue, never()).retry(eq(t), eq(1000L));
95- }
98+ }*/
9699
97100 // More misc Tests:
98101 // Verify that the Sleeper.sleep(2000) call was invoked for a successful attempt:
99- @ Test
102+ /* @Test
100103 void failHandler_callsSleep_onSuccess() throws InterruptedException {
101104 when(props.getFailSuccSleepTime()).thenReturn(2000L);
102105 when(fixedRandom.nextDouble()).thenReturn(0.1);
103106 FailHandler failHandler = new FailHandler(queue, mockSleeper, fixedRandom, props);
104107 failHandler.handle(t);
105108 verify(mockSleeper, times(1)).sleep(2000L);
106- }
109+ }*/
107110 // Verify that the Sleeper.sleep(1000) call happened on permanent failure branch:
108- @ Test
111+ /* @Test
109112 void failHandler_callsSleep_onPermFail() throws InterruptedException {
110113 when(props.getFailSleepTime()).thenReturn(1000L);
111114 t.setAttempts(3);
112115 when(fixedRandom.nextDouble()).thenReturn(0.9);
113116 FailHandler failHandler = new FailHandler(queue, mockSleeper, fixedRandom, props);
114117 failHandler.handle(t);
115118 verify(mockSleeper, times(1)).sleep(1000L);
116- }
119+ }*/
117120}
0 commit comments