@@ -13,10 +13,10 @@ void testForFirstCase() {
13
13
int [][] a = {{0 , 1 }, {0 , 2 }, {0 , 3 }, {2 , 0 }, {2 , 1 }, {1 , 3 }};
14
14
int source = 2 ;
15
15
int destination = 3 ;
16
- List <List <Integer >> list2 = List .of (List .of (2 , 0 , 1 , 3 ), List .of (2 , 0 , 3 ), List .of (2 , 1 , 3 ));
17
- List <List <Integer >> list1 = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
18
- list2 = list1 ;
19
- assertIterableEquals (list1 , list2 );
16
+ List <List <Integer >> expected = List .of (List .of (2 , 0 , 1 , 3 ), List .of (2 , 0 , 3 ), List .of (2 , 1 , 3 ));
17
+ List <List <Integer >> actual = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
18
+
19
+ assertIterableEquals (expected , actual );
20
20
}
21
21
22
22
@ Test
@@ -25,10 +25,10 @@ void testForSecondCase() {
25
25
int [][] a = {{0 , 1 }, {0 , 2 }, {0 , 3 }, {2 , 0 }, {2 , 1 }, {1 , 3 }, {1 , 4 }, {3 , 4 }, {2 , 4 }};
26
26
int source = 0 ;
27
27
int destination = 4 ;
28
- List <List <Integer >> list2 = List .of (List .of (0 , 1 , 3 , 4 ), List .of (0 , 1 , 4 ), List .of (0 , 2 , 1 , 3 , 4 ), List .of (0 , 2 , 1 , 4 ), List .of (0 , 2 , 4 ), List .of (0 , 3 , 4 ));
29
- List <List <Integer >> list1 = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
30
- list2 = list1 ;
31
- assertIterableEquals (list1 , list2 );
28
+ List <List <Integer >> expected = List .of (List .of (0 , 1 , 3 , 4 ), List .of (0 , 1 , 4 ), List .of (0 , 2 , 1 , 3 , 4 ), List .of (0 , 2 , 1 , 4 ), List .of (0 , 2 , 4 ), List .of (0 , 3 , 4 ));
29
+ List <List <Integer >> actual = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
30
+
31
+ assertIterableEquals (expected , actual );
32
32
}
33
33
34
34
@ Test
@@ -37,10 +37,10 @@ void testForThirdCase() {
37
37
int [][] a = {{1 , 0 }, {2 , 3 }, {0 , 4 }, {1 , 5 }, {4 , 3 }, {0 , 2 }, {0 , 3 }, {1 , 2 }, {0 , 5 }, {3 , 4 }, {2 , 5 }, {2 , 4 }};
38
38
int source = 1 ;
39
39
int destination = 5 ;
40
- List <List <Integer >> list2 = List .of (List .of (1 , 0 , 2 , 5 ), List .of (1 , 0 , 5 ), List .of (1 , 5 ), List .of (1 , 2 , 5 ));
41
- List <List <Integer >> list1 = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
42
- list2 = list1 ;
43
- assertIterableEquals (list1 , list2 );
40
+ List <List <Integer >> expected = List .of (List .of (1 , 0 , 2 , 5 ), List .of (1 , 0 , 5 ), List .of (1 , 5 ), List .of (1 , 2 , 5 ));
41
+ List <List <Integer >> actual = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
42
+
43
+ assertIterableEquals (expected , actual );
44
44
}
45
45
46
46
@ Test
@@ -49,9 +49,9 @@ void testForFourthcase() {
49
49
int [][] a = {{0 , 1 }, {0 , 2 }, {1 , 2 }};
50
50
int source = 0 ;
51
51
int destination = 2 ;
52
- List <List <Integer >> list2 = List .of (List .of (0 , 1 , 2 ), List .of (0 , 2 ));
53
- List <List <Integer >> list1 = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
54
- list2 = list1 ;
55
- assertIterableEquals (list1 , list2 );
52
+ List <List <Integer >> expected = List .of (List .of (0 , 1 , 2 ), List .of (0 , 2 ));
53
+ List <List <Integer >> actual = AllPathsFromSourceToTarget .allPathsFromSourceToTarget (vertices , a , source , destination );
54
+
55
+ assertIterableEquals (expected , actual );
56
56
}
57
57
}
0 commit comments