Skip to content

Commit 2251f27

Browse files
authored
Refactor SnellLawTest with additional assertions
1 parent cfe8791 commit 2251f27

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package com.thealgorithms.physics;
22

3-
import static org.junit.jupiter.api.Assertions.*;
3+
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
4+
import static org.junit.jupiter.api.Assertions.assertEquals;
5+
import static org.junit.jupiter.api.Assertions.assertThrows;
6+
47
import org.junit.jupiter.api.Test;
58

69
public class SnellLawTest {
710

811
@Test
912
public void testRefractedAngle() {
10-
double n1 = 1.0; // air
11-
double n2 = 1.5; // glass
13+
double n1 = 1.0; // air
14+
double n2 = 1.5; // glass
1215
double theta1 = Math.toRadians(30);
1316

1417
double theta2 = SnellLaw.refractedAngle(n1, n2, theta1);
@@ -20,10 +23,9 @@ public void testRefractedAngle() {
2023

2124
@Test
2225
public void testTotalInternalReflection() {
23-
// total internal reflection happens when n1 > n2 AND theta1 is large
2426
double n1 = 1.5;
2527
double n2 = 1.0;
26-
double theta1 = Math.toRadians(60); // large enough angle
28+
double theta1 = Math.toRadians(60); // large angle
2729

2830
assertThrows(IllegalArgumentException.class, () -> {
2931
SnellLaw.refractedAngle(n1, n2, theta1);

0 commit comments

Comments
 (0)