Skip to content

Commit 3af83d1

Browse files
clean test
1 parent cb63df8 commit 3af83d1

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

dumper/app/src/test/java/com/google/edwmigration/dumper/application/dumper/TasksRunnerTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
import static org.junit.Assert.fail;
2323
import static org.mockito.Mockito.*;
2424

25-
import ch.qos.logback.classic.Logger;
26-
import ch.qos.logback.classic.spi.ILoggingEvent;
27-
import ch.qos.logback.core.read.ListAppender;
2825
import com.google.edwmigration.dumper.application.dumper.handle.Handle;
2926
import com.google.edwmigration.dumper.application.dumper.io.OutputHandleFactory;
3027
import com.google.edwmigration.dumper.application.dumper.task.Task;
@@ -42,7 +39,6 @@
4239
import org.junit.contrib.java.lang.system.SystemOutRule;
4340
import org.junit.runner.RunWith;
4441
import org.junit.runners.JUnit4;
45-
import org.slf4j.LoggerFactory;
4642

4743
@RunWith(JUnit4.class)
4844
public class TasksRunnerTest {
@@ -70,7 +66,6 @@ public void testCreateContext_returnsValidTaskRunContext() throws IOException {
7066
Collections.emptyList(),
7167
arguments);
7268

73-
// Use reflection to access the private createContext method for direct testing
7469
try {
7570
java.lang.reflect.Method method =
7671
TasksRunner.class.getDeclaredMethod(
@@ -105,21 +100,18 @@ public void testGetTaskDuration_ReturnsMaxOfAllAndLatest() throws Exception {
105100
TasksRunner runner =
106101
new TasksRunner(mockSinkFactory, mockHandle, threadPoolSize, mockState, tasks, arguments);
107102

108-
// Set numberOfCompletedTasks to 5
109103
java.lang.reflect.Field completedField =
110104
TasksRunner.class.getDeclaredField("numberOfCompletedTasks");
111105
completedField.setAccessible(true);
112106
completedField.set(runner, new java.util.concurrent.atomic.AtomicInteger(5));
113107

114-
// Mock stopwatch to control elapsed time
115108
java.lang.reflect.Field stopwatchField =
116109
TasksRunner.class.getDeclaredField("stopwatch");
117110
stopwatchField.setAccessible(true);
118111
com.google.common.base.Stopwatch mockStopwatch = mock(com.google.common.base.Stopwatch.class);
119112
when(mockStopwatch.elapsed()).thenReturn(Duration.ofSeconds(50));
120113
stopwatchField.set(runner, mockStopwatch);
121114

122-
// Fill lastTaskDurations with 5 durations: 10, 20, 30, 40, 50 seconds
123115
java.lang.reflect.Field durationsField =
124116
TasksRunner.class.getDeclaredField("lastTaskDurations");
125117
durationsField.setAccessible(true);
@@ -153,21 +145,18 @@ public void testGetTaskDuration_EmptyLastTaskDurations() throws Exception {
153145
TasksRunner runner =
154146
new TasksRunner(mockSinkFactory, mockHandle, threadPoolSize, mockState, tasks, arguments);
155147

156-
// Set numberOfCompletedTasks to 3
157148
java.lang.reflect.Field completedField =
158149
TasksRunner.class.getDeclaredField("numberOfCompletedTasks");
159150
completedField.setAccessible(true);
160151
completedField.set(runner, new java.util.concurrent.atomic.AtomicInteger(3));
161152

162-
// Mock stopwatch to control elapsed time
163153
java.lang.reflect.Field stopwatchField =
164154
TasksRunner.class.getDeclaredField("stopwatch");
165155
stopwatchField.setAccessible(true);
166156
com.google.common.base.Stopwatch mockStopwatch = mock(com.google.common.base.Stopwatch.class);
167157
when(mockStopwatch.elapsed()).thenReturn(Duration.ofSeconds(9));
168158
stopwatchField.set(runner, mockStopwatch);
169159

170-
// Ensure lastTaskDurations is empty
171160
java.lang.reflect.Field durationsField =
172161
TasksRunner.class.getDeclaredField("lastTaskDurations");
173162
durationsField.setAccessible(true);
@@ -202,15 +191,13 @@ public void testGetTaskDuration_LastTaskDurationsGreaterThanAllTasks() throws Ex
202191
completedField.setAccessible(true);
203192
completedField.set(runner, new java.util.concurrent.atomic.AtomicInteger(2));
204193

205-
// Mock stopwatch to control elapsed time
206194
java.lang.reflect.Field stopwatchField =
207195
TasksRunner.class.getDeclaredField("stopwatch");
208196
stopwatchField.setAccessible(true);
209197
com.google.common.base.Stopwatch mockStopwatch = mock(com.google.common.base.Stopwatch.class);
210198
when(mockStopwatch.elapsed()).thenReturn(Duration.ofSeconds(6));
211199
stopwatchField.set(runner, mockStopwatch);
212200

213-
// Fill lastTaskDurations with 2 durations: 2s, 10s
214201
java.lang.reflect.Field durationsField =
215202
TasksRunner.class.getDeclaredField("lastTaskDurations");
216203
durationsField.setAccessible(true);

0 commit comments

Comments
 (0)