File tree Expand file tree Collapse file tree
main/java/com/team2813/lib2813/testing/truth
test/java/com/team2813/lib2813/testing/truth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ public TolerantComparison<Pose2d> isNotWithin(double tolerance) {
6767 @ Override
6868 public void of (Pose2d expected ) {
6969 translation ().isNotWithin (tolerance ).of (expected .getTranslation ());
70- rotation ().isWithin (tolerance ).of (expected .getRotation ());
70+ rotation ().isNotWithin (tolerance ).of (expected .getRotation ());
7171 }
7272 };
7373 }
Original file line number Diff line number Diff line change @@ -64,8 +64,8 @@ public TolerantComparison<Translation2d> isNotWithin(double tolerance) {
6464 return new TolerantComparison <Translation2d >() {
6565 @ Override
6666 public void of (Translation2d expected ) {
67- x ().isWithin (tolerance ).of (expected .getX ());
68- y ().isWithin (tolerance ).of (expected .getY ());
67+ x ().isNotWithin (tolerance ).of (expected .getX ());
68+ y ().isNotWithin (tolerance ).of (expected .getY ());
6969 }
7070 };
7171 }
Original file line number Diff line number Diff line change @@ -34,6 +34,15 @@ public void isWithin_valueWithinTolerance_doesNotThrow(Pose2dComponent component
3434 Pose2dSubject .assertThat (closePose ).isWithin (0.01 ).of (POSE );
3535 }
3636
37+ @ ParameterizedTest
38+ @ EnumSource (Pose2dComponent .class )
39+ public void isNotWithin_valueWithinTolerance_throws (Pose2dComponent component ) {
40+ Pose2d closePose = component .add (POSE , 0.009 );
41+
42+ assertThrows (
43+ AssertionError .class , () -> Pose2dSubject .assertThat (closePose ).isNotWithin (0.01 ).of (POSE ));
44+ }
45+
3746 @ ParameterizedTest
3847 @ EnumSource (Pose2dComponent .class )
3948 public void isWithin_valueNotWithinTolerance_throws (Pose2dComponent component ) {
@@ -42,4 +51,12 @@ public void isWithin_valueNotWithinTolerance_throws(Pose2dComponent component) {
4251 assertThrows (
4352 AssertionError .class , () -> Pose2dSubject .assertThat (closePose ).isWithin (0.01 ).of (POSE ));
4453 }
54+
55+ @ ParameterizedTest
56+ @ EnumSource (Pose2dComponent .class )
57+ public void isNotWithin_valueNotWithinTolerance_doesNotThrow (Pose2dComponent component ) {
58+ Pose2d closePose = component .add (POSE , 0.011 );
59+
60+ Pose2dSubject .assertThat (closePose ).isNotWithin (0.01 ).of (POSE );
61+ }
4562}
You can’t perform that action at this time.
0 commit comments