Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.

Commit c65fa4b

Browse files
[autofix.ci] apply automated fixes
1 parent b95a252 commit c65fa4b

2 files changed

Lines changed: 23 additions & 22 deletions

File tree

shared/src/main/java/com/team581/math/ObstructionCalculator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public boolean isObstructed(Translation2d start, Translation2d end) {
4848
}
4949

5050
public boolean isObstructed(Vector2D point) {
51-
return region.contains((point));
51+
return region.contains(point);
5252
}
5353

5454
public boolean isObstructed(Vector2D start, Vector2D end) {
Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
package 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;
66
import edu.wpi.first.math.geometry.Translation2d;
7-
import java.util.List;
87
import org.junit.jupiter.api.Test;
98

109
final 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

Comments
 (0)