@@ -244,7 +244,9 @@ point or the last point (or both) coincides with the vertex, the angle is undefi
244244 };
245245
246246 //Tests that false is returned when NUMPOINTS < 3
247- assertFalse (LIC .LIC2 (points1 .length , points1 , p ));
247+ assertThrows (IllegalArgumentException .class , () -> {
248+ LIC .LIC2 (points1 .length , points1 , p );
249+ });
248250
249251 //Tests that false is returned if any point coincides with the vertex
250252 assertFalse (LIC .LIC2 (points2 .length , points2 , p ));
@@ -255,11 +257,15 @@ point or the last point (or both) coincides with the vertex, the angle is undefi
255257
256258 //Tests that false is returned when EPSILON < 0
257259 p .EPSILON = -0.01 ;
258- assertFalse (LIC .LIC2 (points4 .length , points4 , p ));
260+ assertThrows (IllegalArgumentException .class , () -> {
261+ LIC .LIC2 (points4 .length , points4 , p );
262+ });
259263
260264 //Tests that false is returned when EPISILON > PI
261265 p .EPSILON = PI + 0.01 ;
262- assertFalse (LIC .LIC2 (points4 .length , points4 , p ));
266+ assertThrows (IllegalArgumentException .class , () -> {
267+ LIC .LIC2 (points4 .length , points4 , p );
268+ });
263269
264270 //Tests that false is returned when there does not exist at least one set of three
265271 //consecutive data points which form an angle such that: angle < (PI−EPSILON)
@@ -698,19 +704,6 @@ public void testLIC8() {
698704 * A PTS+B PTS ≤ (NUMPOINTS−3)
699705 */
700706
701- Point [] points1 = new Point [] {
702- new Point (0 , 10 ),
703- new Point (0 , 0 ),
704- new Point (-10 , 0 ),
705- new Point (10 , 0 )
706- };
707- // Tests that false is returned when NUMPOINTS < 5
708- Parameters p = new Parameters ();
709- p .RADIUS1 = 3 ;
710- p .A_PTS = 1 ;
711- p .B_PTS = 1 ;
712- assertFalse (LIC .LIC8 (points1 .length , points1 , p ));
713-
714707 Point [] points2 = new Point [] {
715708 new Point (0 , 10 ),
716709 new Point (0 , 0 ),
@@ -719,23 +712,28 @@ public void testLIC8() {
719712 new Point (10 , 0 )
720713 };
721714
722-
715+ Parameters p = new Parameters ();
723716 p .RADIUS1 = 1 ;
724717 p .A_PTS = 0 ;
725718 p .B_PTS = 1 ;
726719
727- // Tests that false is returned when A PTS < 1
728- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
729-
730- // Tests that false is returned when B PTS < 1
720+ // Tests that IllegalArgumentException is thrown when A PTS < 1
721+ assertThrows (IllegalArgumentException .class , () -> {
722+ LIC .LIC8 (points2 .length , points2 , p );
723+ });
724+ // Tests that IllegalArgumentException is thrown when B PTS < 1
731725 p .A_PTS = 1 ;
732726 p .B_PTS = 0 ;
733- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
727+ assertThrows (IllegalArgumentException .class , () -> {
728+ LIC .LIC8 (points2 .length , points2 , p );
729+ });
734730
735- // Tests that false is returned when A PTS + B PTS > (NUMPOINTS-3)
731+ // Tests that IllegalArgumentException is thrown when A PTS + B PTS > (NUMPOINTS-3)
736732 p .A_PTS = 2 ;
737733 p .B_PTS = 1 ;
738- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
734+ assertThrows (IllegalArgumentException .class , () -> {
735+ LIC .LIC8 (points2 .length , points2 , p );
736+ });
739737
740738 // Tests that false is returned when there exists a set of three data points
741739 // separated by exactly A PTS and B PTS
@@ -763,9 +761,11 @@ public void testLIC8() {
763761 p .RADIUS1 = 1 ;
764762 assertFalse (LIC .LIC8 (points3 .length , points3 , p ));
765763
766- // Tests that false is returned if RADIUS1 < 0:
764+ // Tests that IllegalArgumentException is thrown when RADIUS1 < 0:
767765 p .RADIUS1 = -1 ;
768- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
766+ assertThrows (IllegalArgumentException .class , () -> {
767+ LIC .LIC8 (points2 .length , points2 , p );
768+ });
769769
770770 p .RADIUS1 = 1 ;
771771 // Tests that true is returned for a valid input
@@ -1068,11 +1068,6 @@ public void testLIC11() {
10681068 new Point (-1 , 1 )
10691069 };
10701070
1071- Point [] points2 = new Point [] {
1072- new Point (1 , -1 ),
1073- new Point (-1 , 1 )
1074- };
1075-
10761071 Point [] points3 = new Point [] {
10771072 new Point (-1 , -1 ),
10781073 new Point (0 , 0 ),
@@ -1086,22 +1081,23 @@ public void testLIC11() {
10861081
10871082 };
10881083 Parameters p = new Parameters ();
1089- p .G_PTS = 1 ;
1090-
1091- //Tests that false is returned when NUMPOINTS < 3
1092- assertFalse (LIC .LIC11 (points2 .length , points2 , p ));
10931084
1094- //Tests that false is returned when G_PTS < 1
10951085 p .G_PTS = 0 ;
1096- assertFalse (LIC .LIC11 (points1 .length , points1 , p ));
1086+ // Tests that IllegalArgumentException is thrown when G_PTS < 1
1087+ assertThrows (IllegalArgumentException .class , () -> {
1088+ LIC .LIC11 (points1 .length , points1 , p );
1089+ });
10971090
1098- //Tests that false is returned when NUMPOINTS-2 < G_PTS
10991091 p .G_PTS = 2 ;
1100- assertFalse (LIC .LIC11 (points1 .length , points1 , p ));
1092+ // Tests that IllegalArgumentException is thrown when NUMPOINTS-2 < G_PTS
1093+ assertThrows (IllegalArgumentException .class , () -> {
1094+ LIC .LIC11 (points1 .length , points1 , p );
1095+ });
11011096
11021097 //Tests that false is returned when there does not exist at least one set of two data points,
11031098 //(X[i],Y[i]) and (X[j],Y[j]), separated by
11041099 //exactly G PTS consecutive intervening points, such that X[j] - X[i] < 0. (where i < j )
1100+ p .G_PTS = 1 ;
11051101 assertFalse (LIC .LIC11 (points3 .length , points3 , p ));
11061102
11071103 //Tests that false is returned if there exists at least one set of two data points,
0 commit comments