@@ -124,10 +124,7 @@ void testCompleteTree() {
124124 @ Test
125125 void testLargerTree () {
126126 // Tree with 10 nodes
127- int [][] edges = {
128- {0 , 1 }, {0 , 2 }, {1 , 3 }, {1 , 4 },
129- {2 , 5 }, {2 , 6 }, {3 , 7 }, {4 , 8 }, {5 , 9 }
130- };
127+ int [][] edges = {{0 , 1 }, {0 , 2 }, {1 , 3 }, {1 , 4 }, {2 , 5 }, {2 , 6 }, {3 , 7 }, {4 , 8 }, {5 , 9 }};
131128 CentroidDecomposition .CentroidTree tree = CentroidDecomposition .buildFromEdges (10 , edges );
132129
133130 assertEquals (10 , tree .size ());
@@ -179,7 +176,7 @@ void testInvalidNullEdges() {
179176 @ Test
180177 void testInvalidEdgeCount () {
181178 // Tree with n nodes must have n-1 edges
182- int [][] edges = {{0 , 1 }, {1 , 2 }}; // 3 edges for 5 nodes
179+ int [][] edges = {{0 , 1 }, {1 , 2 }}; // 2 edges for 5 nodes (should be 4)
183180 assertThrows (IllegalArgumentException .class , () -> {
184181 CentroidDecomposition .buildFromEdges (5 , edges );
185182 });
@@ -245,15 +242,11 @@ void testAdjacencyListConstructor() {
245242
246243 @ Test
247244 void testNullAdjacencyList () {
248- assertThrows (IllegalArgumentException .class , () -> {
249- new CentroidDecomposition .CentroidTree (null );
250- });
245+ assertThrows (IllegalArgumentException .class , () -> { new CentroidDecomposition .CentroidTree (null ); });
251246 }
252247
253248 @ Test
254249 void testEmptyAdjacencyList () {
255- assertThrows (IllegalArgumentException .class , () -> {
256- new CentroidDecomposition .CentroidTree (new ArrayList <>());
257- });
250+ assertThrows (IllegalArgumentException .class , () -> { new CentroidDecomposition .CentroidTree (new ArrayList <>()); });
258251 }
259252}
0 commit comments