@@ -15,10 +15,9 @@ class SJFSchedulingTest {
15
15
16
16
private static Stream <Arguments > schedulingTestData () {
17
17
return Stream .of (Arguments .of (List .of (new ProcessDetails ("1" , 0 , 6 ), new ProcessDetails ("2" , 1 , 2 )), List .of ("1" , "2" )),
18
- Arguments .of (List .of (new ProcessDetails ("1" , 0 , 6 ), new ProcessDetails ("2" , 1 , 2 ), new ProcessDetails ("3" , 4 , 3 ), new ProcessDetails ("4" , 3 , 1 ), new ProcessDetails ("5" , 6 , 4 ), new ProcessDetails ("6" , 5 , 5 )), List .of ("1" , "4" , "2" , "3" , "5" , "6" )),
19
- Arguments .of (List .of (new ProcessDetails ("1" , 0 , 3 ), new ProcessDetails ("2" , 1 , 2 ), new ProcessDetails ("3" , 2 , 1 )), List .of ("1" , "3" , "2" )),
20
- Arguments .of (List .of (new ProcessDetails ("1" , 0 , 3 ), new ProcessDetails ("2" , 5 , 2 ), new ProcessDetails ("3" , 9 , 1 )), List .of ("1" , "2" , "3" )),
21
- Arguments .of (Collections .emptyList (), List .of ()));
18
+ Arguments .of (List .of (new ProcessDetails ("1" , 0 , 6 ), new ProcessDetails ("2" , 1 , 2 ), new ProcessDetails ("3" , 4 , 3 ), new ProcessDetails ("4" , 3 , 1 ), new ProcessDetails ("5" , 6 , 4 ), new ProcessDetails ("6" , 5 , 5 )), List .of ("1" , "4" , "2" , "3" , "5" , "6" )),
19
+ Arguments .of (List .of (new ProcessDetails ("1" , 0 , 3 ), new ProcessDetails ("2" , 1 , 2 ), new ProcessDetails ("3" , 2 , 1 )), List .of ("1" , "3" , "2" )), Arguments .of (List .of (new ProcessDetails ("1" , 0 , 3 ), new ProcessDetails ("2" , 5 , 2 ), new ProcessDetails ("3" , 9 , 1 )), List .of ("1" , "2" , "3" )),
20
+ Arguments .of (Collections .emptyList (), List .of ()));
22
21
}
23
22
24
23
@ ParameterizedTest (name = "Test SJF schedule: {index}" )
@@ -31,11 +30,10 @@ void testSJFScheduling(List<ProcessDetails> inputProcesses, List<String> expecte
31
30
32
31
@ Test
33
32
@ DisplayName ("Test sorting by arrival order" )
34
- void testProcessArrivalOrderIsSorted () {List <ProcessDetails > processes = List .of (new ProcessDetails ("1" , 0 , 6 ), new ProcessDetails ("2" , 1 , 2 ), new ProcessDetails ("4" , 3 , 1 ), new ProcessDetails ("3" , 4 , 3 ), new ProcessDetails ("6" , 5 , 5 ), new ProcessDetails ("5" , 6 , 4 ));
33
+ void testProcessArrivalOrderIsSorted () {
34
+ List <ProcessDetails > processes = List .of (new ProcessDetails ("1" , 0 , 6 ), new ProcessDetails ("2" , 1 , 2 ), new ProcessDetails ("4" , 3 , 1 ), new ProcessDetails ("3" , 4 , 3 ), new ProcessDetails ("6" , 5 , 5 ), new ProcessDetails ("5" , 6 , 4 ));
35
35
SJFScheduling scheduler = new SJFScheduling (processes );
36
- List <String > actualOrder = scheduler .getProcesses ().stream ()
37
- .map (ProcessDetails ::getProcessId )
38
- .toList ();
36
+ List <String > actualOrder = scheduler .getProcesses ().stream ().map (ProcessDetails ::getProcessId ).toList ();
39
37
40
38
assertEquals (List .of ("1" , "2" , "4" , "3" , "6" , "5" ), actualOrder );
41
39
}
0 commit comments