1
1
/*
2
- * Copyright (c) 2012, 2024 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2012, 2025 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -188,7 +188,7 @@ public void testPathInsideXAndInsideYBounds() {
188
188
lineChart .getData ().addAll (series1 );
189
189
pulse ();
190
190
191
- assertArrayEquals ( convertSeriesDataToPoint2D ( series1 ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
191
+ eq ( series1 , lineChart );
192
192
}
193
193
194
194
@ Test
@@ -210,7 +210,7 @@ public void testPathOutsideXBoundsWithDuplicateXAndHigherY() {
210
210
new XYChart .Data <>(100d , 20d )
211
211
);
212
212
213
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
213
+ eq ( expectedSeries , lineChart );
214
214
}
215
215
216
216
@ Test
@@ -232,7 +232,7 @@ public void testPathOutsideXBoundsWithDuplicateXAndLowerY() {
232
232
new XYChart .Data <>(100d , 20d )
233
233
);
234
234
235
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
235
+ eq ( expectedSeries , lineChart );
236
236
}
237
237
238
238
@ Test
@@ -255,7 +255,7 @@ public void testPathOutsideYBoundsWithDuplicateYAndHigherX() {
255
255
new XYChart .Data <>(90d , 32d )
256
256
);
257
257
258
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
258
+ eq ( expectedSeries , lineChart );
259
259
}
260
260
261
261
@ Test
@@ -278,7 +278,7 @@ public void testPathOutsideYBoundsWithDuplicateYAndLowerX() {
278
278
new XYChart .Data <>(90d , 40d )
279
279
);
280
280
281
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
281
+ eq ( expectedSeries , lineChart );
282
282
}
283
283
284
284
@ Test
@@ -300,7 +300,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateXAndHigherY() {
300
300
new XYChart .Data <>(95d , 35d )
301
301
);
302
302
303
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
303
+ eq ( expectedSeries , lineChart );
304
304
}
305
305
306
306
@ Test
@@ -322,7 +322,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateXAndLowerY() {
322
322
new XYChart .Data <>(95d , 40d )
323
323
);
324
324
325
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
325
+ eq ( expectedSeries , lineChart );
326
326
}
327
327
328
328
@ Test
@@ -344,7 +344,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateYAndHigherX() {
344
344
new XYChart .Data <>(95d , 32d )
345
345
);
346
346
347
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
347
+ eq ( expectedSeries , lineChart );
348
348
}
349
349
350
350
@ Test
@@ -366,7 +366,7 @@ public void testPathOutsideXAndYBoundsWithDuplicateYAndLowerX() {
366
366
new XYChart .Data <>(95d , 40d )
367
367
);
368
368
369
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
369
+ eq ( expectedSeries , lineChart );
370
370
}
371
371
372
372
@ Test
@@ -390,7 +390,7 @@ public void testPathOutsideXLowerBoundsWithDuplicateXAndHigherYWithSortYAxis() {
390
390
new XYChart .Data <>(80d , 10d )
391
391
);
392
392
393
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
393
+ eq ( expectedSeries , lineChart );
394
394
}
395
395
396
396
@ Test
@@ -414,7 +414,7 @@ public void testPathOutsideXUpperBoundsWithDuplicateXAndHigherYWithSortYAxis() {
414
414
new XYChart .Data <>(80d , 10d )
415
415
);
416
416
417
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
417
+ eq ( expectedSeries , lineChart );
418
418
}
419
419
420
420
@ Test
@@ -438,7 +438,7 @@ public void testPathOutsideXLowerBoundsWithDuplicateXAndLowerYWithSortYAxis() {
438
438
new XYChart .Data <>(80d , 10d )
439
439
);
440
440
441
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
441
+ eq ( expectedSeries , lineChart );
442
442
}
443
443
444
444
@ Test
@@ -462,7 +462,7 @@ public void testPathOutsideXUpperBoundsWithDuplicateXAndLowerYWithSortYAxis() {
462
462
new XYChart .Data <>(80d , 10d )
463
463
);
464
464
465
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
465
+ eq ( expectedSeries , lineChart );
466
466
}
467
467
468
468
@ Test
@@ -485,7 +485,7 @@ public void testPathOutsideYLowerBoundsWithDuplicateYAndHigherXWithSortYAxis() {
485
485
new XYChart .Data <>(80d , -10d )
486
486
);
487
487
488
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
488
+ eq ( expectedSeries , lineChart );
489
489
}
490
490
491
491
@ Test
@@ -508,7 +508,7 @@ public void testPathOutsideYUpperBoundsWithDuplicateYAndHigherXWithSortYAxis() {
508
508
new XYChart .Data <>(80d , 10d )
509
509
);
510
510
511
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
511
+ eq ( expectedSeries , lineChart );
512
512
}
513
513
514
514
@ Test
@@ -530,7 +530,7 @@ public void testPathOutsideYLowerBoundsWithDuplicateYAndLowerXWithSortYAxis() {
530
530
new XYChart .Data <>(80d , 10d ),
531
531
new XYChart .Data <>(80d , -10d )
532
532
);
533
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
533
+ eq ( expectedSeries , lineChart );
534
534
}
535
535
536
536
@ Test
@@ -553,7 +553,7 @@ public void testPathOutsideYUpperBoundsWithDuplicateYAndLowerXWithSortYAxis() {
553
553
new XYChart .Data <>(80d , 10d )
554
554
);
555
555
556
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
556
+ eq ( expectedSeries , lineChart );
557
557
}
558
558
559
559
@ Test
@@ -577,7 +577,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateXAndHigherYWithSortYAxis
577
577
new XYChart.Data<>(95d, -10d)*/
578
578
);
579
579
580
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
580
+ eq ( expectedSeries , lineChart );
581
581
}
582
582
583
583
@ Test
@@ -600,7 +600,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateXAndHigherYWithSortYAxis
600
600
new XYChart .Data <>(80d , 10d )
601
601
);
602
602
603
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
603
+ eq ( expectedSeries , lineChart );
604
604
}
605
605
606
606
@ Test
@@ -623,7 +623,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateXAndLowerYWithSortYAxis(
623
623
new XYChart .Data <>(-10d , -10d )
624
624
);
625
625
626
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
626
+ eq ( expectedSeries , lineChart );
627
627
}
628
628
629
629
@ Test
@@ -646,7 +646,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateXAndLowerYWithSortYAxis(
646
646
new XYChart .Data <>(80d , 10d )
647
647
);
648
648
649
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
649
+ eq ( expectedSeries , lineChart );
650
650
}
651
651
652
652
@ Test
@@ -669,7 +669,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateYAndHigherXWithSortYAxis
669
669
new XYChart .Data <>(-15d , -10d )
670
670
);
671
671
672
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
672
+ eq ( expectedSeries , lineChart );
673
673
}
674
674
675
675
@ Test
@@ -692,7 +692,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateYAndHigherXWithSortYAxis
692
692
new XYChart .Data <>(80d , 10d )
693
693
);
694
694
695
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
695
+ eq ( expectedSeries , lineChart );
696
696
}
697
697
698
698
@ Test
@@ -715,7 +715,7 @@ public void testPathOutsideXAndYLowerBoundsWithDuplicateYAndLowerXWithSortYAxis(
715
715
new XYChart .Data <>(-10d , -10d )
716
716
);
717
717
718
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
718
+ eq ( expectedSeries , lineChart );
719
719
}
720
720
721
721
@ Test
@@ -738,7 +738,7 @@ public void testPathOutsideXAndYUpperBoundsWithDuplicateYAndLowerXWithSortYAxis(
738
738
new XYChart .Data <>(80d , 10d )
739
739
);
740
740
741
- assertArrayEquals ( convertSeriesDataToPoint2D ( expectedSeries ). toArray (), findDataPointsFromPathLine ( lineChart ). toArray () );
741
+ eq ( expectedSeries , lineChart );
742
742
}
743
743
744
744
//JDK-8283675
@@ -777,4 +777,17 @@ private List<Point2D> findDataPointsFromPathLine(LineChart<Number, Number> lineC
777
777
.collect (Collectors .toList ());
778
778
return data .subList (0 , data .size ());
779
779
}
780
+
781
+ private void eq (XYChart .Series <Number , Number > expected , LineChart <Number , Number > ch ) {
782
+ List <Point2D > exp = convertSeriesDataToPoint2D (expected );
783
+ List <Point2D > res = findDataPointsFromPathLine (lineChart );
784
+
785
+ assertEquals (exp .size (), res .size ());
786
+ for (int i = 0 ; i < exp .size (); i ++) {
787
+ Point2D pe = exp .get (i );
788
+ Point2D pr = res .get (i );
789
+ assertEquals (pe .getX (), pr .getX (), 1e-9 , "at index " + i + " expected=" + pe + " actual=" + pr );
790
+ assertEquals (pe .getY (), pr .getY (), 1e-9 , "at index " + i + " expected=" + pe + " actual=" + pr );
791
+ }
792
+ }
780
793
}
0 commit comments