Skip to content

Commit 0d7efd2

Browse files
authored
Simplify assertions in SnellLawTest
1 parent e131ff9 commit 0d7efd2

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/test/java/com/thealgorithms/physics/SnellLawTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public void testRefractedAngle() {
1616

1717
double theta2 = SnellLaw.refractedAngle(n1, n2, theta1);
1818

19-
double expected = Math.asin((n1 / n2) * Math.sin(theta1));
19+
double expected = Math.asin(n1 / n2 * Math.sin(theta1));
2020

2121
assertEquals(expected, theta2, 1e-12);
2222
}
@@ -27,9 +27,7 @@ public void testTotalInternalReflection() {
2727
double n2 = 1.0;
2828
double theta1 = Math.toRadians(60); // large angle
2929

30-
assertThrows(IllegalArgumentException.class, () -> {
31-
SnellLaw.refractedAngle(n1, n2, theta1);
32-
});
30+
assertThrows(IllegalArgumentException.class, () -> SnellLaw.refractedAngle(n1, n2, theta1));
3331
}
3432

3533
@Test
@@ -38,8 +36,6 @@ public void testNoTotalInternalReflectionAtLowAngles() {
3836
double n2 = 1.0;
3937
double theta1 = Math.toRadians(10);
4038

41-
assertDoesNotThrow(() -> {
42-
SnellLaw.refractedAngle(n1, n2, theta1);
43-
});
39+
assertDoesNotThrow(() -> SnellLaw.refractedAngle(n1, n2, theta1));
4440
}
4541
}

0 commit comments

Comments
 (0)