@@ -15,10 +15,9 @@ class SJFSchedulingTest {
1515
1616 private static Stream <Arguments > schedulingTestData () {
1717 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 ()));
2221 }
2322
2423 @ ParameterizedTest (name = "Test SJF schedule: {index}" )
@@ -31,11 +30,10 @@ void testSJFScheduling(List<ProcessDetails> inputProcesses, List<String> expecte
3130
3231 @ Test
3332 @ 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 ));
3535 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 ();
3937
4038 assertEquals (List .of ("1" , "2" , "4" , "3" , "6" , "5" ), actualOrder );
4139 }
0 commit comments