11package com .team581 .math ;
22
3- import static org .junit .jupiter .api .Assertions .assertFalse ;
4- import static org .junit .jupiter .api .Assertions .assertTrue ;
3+ import static org .assertj .core .api .Assertions .assertThat ;
54
5+ import com .google .common .collect .ImmutableList ;
66import edu .wpi .first .math .geometry .Translation2d ;
7- import java .util .List ;
87import org .junit .jupiter .api .Test ;
98
109final class ObstructionCalculatorTest {
1110 private static final ObstructionCalculator CALCULATOR =
1211 ObstructionCalculator .fromTranslations (
13- List .of (
12+ ImmutableList .of (
1413 new Translation2d (0 , 0 ),
1514 new Translation2d (2 , 0 ),
1615 new Translation2d (2 , 2 ),
@@ -20,82 +19,84 @@ final class ObstructionCalculatorTest {
2019 void multipleObstructions () {
2120 var calculator =
2221 ObstructionCalculator .fromTranslations (
23- List .of (
22+ ImmutableList .of (
2423 new Translation2d (0 , 0 ),
2524 new Translation2d (1 , 0 ),
2625 new Translation2d (1 , 1 ),
2726 new Translation2d (0 , 1 )),
28- List .of (
27+ ImmutableList .of (
2928 new Translation2d (5 , 5 ),
3029 new Translation2d (6 , 5 ),
3130 new Translation2d (6 , 6 ),
3231 new Translation2d (5 , 6 )));
3332
34- assertTrue (calculator .isObstructed (new Translation2d (0.5 , 0.5 )));
35- assertTrue (calculator .isObstructed (new Translation2d (5.5 , 5.5 )));
36- assertFalse (calculator .isObstructed (new Translation2d (3 , 3 )));
33+ assertThat (calculator .isObstructed (new Translation2d (0.5 , 0.5 ))). isTrue ( );
34+ assertThat (calculator .isObstructed (new Translation2d (5.5 , 5.5 ))). isTrue ( );
35+ assertThat (calculator .isObstructed (new Translation2d (3 , 3 ))). isFalse ( );
3736 }
3837
3938 @ Test
4039 void pointInsideObstructionIsObstructed () {
41- assertTrue (CALCULATOR .isObstructed (new Translation2d (1 , 1 )));
40+ assertThat (CALCULATOR .isObstructed (new Translation2d (1 , 1 ))). isTrue ( );
4241 }
4342
4443 @ Test
4544 void pointOnCornerIsObstructed () {
46- assertTrue (CALCULATOR .isObstructed (new Translation2d (0 , 0 )));
45+ assertThat (CALCULATOR .isObstructed (new Translation2d (0 , 0 ))). isTrue ( );
4746 }
4847
4948 @ Test
5049 void pointOnEdgeIsObstructed () {
51- assertTrue (CALCULATOR .isObstructed (new Translation2d (1 , 0 )));
50+ assertThat (CALCULATOR .isObstructed (new Translation2d (1 , 0 ))). isTrue ( );
5251 }
5352
5453 @ Test
5554 void pointOutsideObstructionIsNotObstructed () {
56- assertFalse (CALCULATOR .isObstructed (new Translation2d (5 , 5 )));
55+ assertThat (CALCULATOR .isObstructed (new Translation2d (5 , 5 ))). isFalse ( );
5756 }
5857
5958 @ Test
6059 void segmentBetweenObstructionsIsNotObstructed () {
6160 var calculator =
6261 ObstructionCalculator .fromTranslations (
63- List .of (
62+ ImmutableList .of (
6463 new Translation2d (0 , 0 ),
6564 new Translation2d (1 , 0 ),
6665 new Translation2d (1 , 1 ),
6766 new Translation2d (0 , 1 )),
68- List .of (
67+ ImmutableList .of (
6968 new Translation2d (3 , 0 ),
7069 new Translation2d (4 , 0 ),
7170 new Translation2d (4 , 1 ),
7271 new Translation2d (3 , 1 )));
7372
74- assertFalse (calculator .isObstructed (new Translation2d (1.5 , 0.5 ), new Translation2d (2.5 , 0.5 )));
73+ assertThat (calculator .isObstructed (new Translation2d (1.5 , 0.5 ), new Translation2d (2.5 , 0.5 )))
74+ .isFalse ();
7575 }
7676
7777 @ Test
7878 void segmentEndingAtEdgeIsObstructed () {
79- assertTrue (CALCULATOR .isObstructed (new Translation2d (-1 , 1 ), new Translation2d (0 , 1 )));
79+ assertThat (CALCULATOR .isObstructed (new Translation2d (-1 , 1 ), new Translation2d (0 , 1 ))). isTrue ( );
8080 }
8181
8282 @ Test
8383 void segmentEntirelyInsideObstructionIsObstructed () {
84- assertTrue (CALCULATOR .isObstructed (new Translation2d (0.5 , 0.5 ), new Translation2d (1.5 , 1.5 )));
84+ assertThat (CALCULATOR .isObstructed (new Translation2d (0.5 , 0.5 ), new Translation2d (1.5 , 1.5 )))
85+ .isTrue ();
8586 }
8687
8788 @ Test
8889 void segmentOutsideObstructionIsNotObstructed () {
89- assertFalse (CALCULATOR .isObstructed (new Translation2d (3 , 3 ), new Translation2d (5 , 5 )));
90+ assertThat (CALCULATOR .isObstructed (new Translation2d (3 , 3 ), new Translation2d (5 , 5 ))). isFalse ( );
9091 }
9192
9293 @ Test
9394 void segmentStartingInsideIsObstructed () {
94- assertTrue (CALCULATOR .isObstructed (new Translation2d (1 , 1 ), new Translation2d (5 , 5 )));
95+ assertThat (CALCULATOR .isObstructed (new Translation2d (1 , 1 ), new Translation2d (5 , 5 ))). isTrue ( );
9596 }
9697
9798 @ Test
9899 void segmentThroughObstructionIsObstructed () {
99- assertTrue (CALCULATOR .isObstructed (new Translation2d (-1 , 1 ), new Translation2d (3 , 1 )));
100+ assertThat (CALCULATOR .isObstructed (new Translation2d (-1 , 1 ), new Translation2d (3 , 1 ))). isTrue ( );
100101 }
101102}
0 commit comments