@@ -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)
@@ -695,19 +701,6 @@ public void testLIC8() {
695701 * A PTS+B PTS ≤ (NUMPOINTS−3)
696702 */
697703
698- Point [] points1 = new Point [] {
699- new Point (0 , 10 ),
700- new Point (0 , 0 ),
701- new Point (-10 , 0 ),
702- new Point (10 , 0 )
703- };
704- // Tests that false is returned when NUMPOINTS < 5
705- Parameters p = new Parameters ();
706- p .RADIUS1 = 3 ;
707- p .A_PTS = 1 ;
708- p .B_PTS = 1 ;
709- assertFalse (LIC .LIC8 (points1 .length , points1 , p ));
710-
711704 Point [] points2 = new Point [] {
712705 new Point (0 , 10 ),
713706 new Point (0 , 0 ),
@@ -716,23 +709,28 @@ public void testLIC8() {
716709 new Point (10 , 0 )
717710 };
718711
719-
712+ Parameters p = new Parameters ();
720713 p .RADIUS1 = 1 ;
721714 p .A_PTS = 0 ;
722715 p .B_PTS = 1 ;
723716
724- // Tests that false is returned when A PTS < 1
725- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
726-
727- // Tests that false is returned when B PTS < 1
717+ // Tests that IllegalArgumentException is thrown when A PTS < 1
718+ assertThrows (IllegalArgumentException .class , () -> {
719+ LIC .LIC8 (points2 .length , points2 , p );
720+ });
721+ // Tests that IllegalArgumentException is thrown when B PTS < 1
728722 p .A_PTS = 1 ;
729723 p .B_PTS = 0 ;
730- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
724+ assertThrows (IllegalArgumentException .class , () -> {
725+ LIC .LIC8 (points2 .length , points2 , p );
726+ });
731727
732- // Tests that false is returned when A PTS + B PTS > (NUMPOINTS-3)
728+ // Tests that IllegalArgumentException is thrown when A PTS + B PTS > (NUMPOINTS-3)
733729 p .A_PTS = 2 ;
734730 p .B_PTS = 1 ;
735- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
731+ assertThrows (IllegalArgumentException .class , () -> {
732+ LIC .LIC8 (points2 .length , points2 , p );
733+ });
736734
737735 // Tests that false is returned when there exists a set of three data points
738736 // separated by exactly A PTS and B PTS
@@ -760,9 +758,11 @@ public void testLIC8() {
760758 p .RADIUS1 = 1 ;
761759 assertFalse (LIC .LIC8 (points3 .length , points3 , p ));
762760
763- // Tests that false is returned if RADIUS1 < 0:
761+ // Tests that IllegalArgumentException is thrown when RADIUS1 < 0:
764762 p .RADIUS1 = -1 ;
765- assertFalse (LIC .LIC8 (points2 .length , points2 , p ));
763+ assertThrows (IllegalArgumentException .class , () -> {
764+ LIC .LIC8 (points2 .length , points2 , p );
765+ });
766766
767767 p .RADIUS1 = 1 ;
768768 // Tests that true is returned for a valid input
@@ -1057,11 +1057,6 @@ public void testLIC11() {
10571057 new Point (-1 , 1 )
10581058 };
10591059
1060- Point [] points2 = new Point [] {
1061- new Point (1 , -1 ),
1062- new Point (-1 , 1 )
1063- };
1064-
10651060 Point [] points3 = new Point [] {
10661061 new Point (-1 , -1 ),
10671062 new Point (0 , 0 ),
@@ -1075,22 +1070,23 @@ public void testLIC11() {
10751070
10761071 };
10771072 Parameters p = new Parameters ();
1078- p .G_PTS = 1 ;
1079-
1080- //Tests that false is returned when NUMPOINTS < 3
1081- assertFalse (LIC .LIC11 (points2 .length , points2 , p ));
10821073
1083- //Tests that false is returned when G_PTS < 1
10841074 p .G_PTS = 0 ;
1085- assertFalse (LIC .LIC11 (points1 .length , points1 , p ));
1075+ // Tests that IllegalArgumentException is thrown when G_PTS < 1
1076+ assertThrows (IllegalArgumentException .class , () -> {
1077+ LIC .LIC11 (points1 .length , points1 , p );
1078+ });
10861079
1087- //Tests that false is returned when NUMPOINTS-2 < G_PTS
10881080 p .G_PTS = 2 ;
1089- assertFalse (LIC .LIC11 (points1 .length , points1 , p ));
1081+ // Tests that IllegalArgumentException is thrown when NUMPOINTS-2 < G_PTS
1082+ assertThrows (IllegalArgumentException .class , () -> {
1083+ LIC .LIC11 (points1 .length , points1 , p );
1084+ });
10901085
10911086 //Tests that false is returned when there does not exist at least one set of two data points,
10921087 //(X[i],Y[i]) and (X[j],Y[j]), separated by
10931088 //exactly G PTS consecutive intervening points, such that X[j] - X[i] < 0. (where i < j )
1089+ p .G_PTS = 1 ;
10941090 assertFalse (LIC .LIC11 (points3 .length , points3 , p ));
10951091
10961092 //Tests that false is returned if there exists at least one set of two data points,
0 commit comments