@@ -15,59 +15,59 @@ final class RelativityTest {
1515 private static final double DELTA = 1e-6 ;
1616 private static final double C = Relativity .SPEED_OF_LIGHT ;
1717
18- @ Test
19- @ DisplayName ("Test the gamma parameter" )
20- void testGamma () {
21- double myGamma = Relativity .gamma (0.6 * C );
22- assertEquals (1.25 , myGamma , DELTA );
23- }
18+ @ Test
19+ @ DisplayName ("Test the gamma parameter" )
20+ void testGamma () {
21+ double myGamma = Relativity .gamma (0.6 * C );
22+ assertEquals (1.25 , myGamma , DELTA );
23+ }
2424
25- @ Test
26- @ DisplayName ("Test the length contraction" )
27- void testLengthContraction () {
28- double myLength = Relativity .lengthContraction (5.0 , 0.8 * C );
29- assertEquals (3.0 , myLength , DELTA );
30- }
25+ @ Test
26+ @ DisplayName ("Test the length contraction" )
27+ void testLengthContraction () {
28+ double myLength = Relativity .lengthContraction (5.0 , 0.8 * C );
29+ assertEquals (3.0 , myLength , DELTA );
30+ }
3131
32- @ Test
33- @ DisplayName ("Test the time dilation" )
34- void testTimeDilation () {
35- double myTime = Relativity .timeDilation (4.0 , 0.6 * C );
36- assertEquals (5.0 , myTime , DELTA );
37- }
32+ @ Test
33+ @ DisplayName ("Test the time dilation" )
34+ void testTimeDilation () {
35+ double myTime = Relativity .timeDilation (4.0 , 0.6 * C );
36+ assertEquals (5.0 , myTime , DELTA );
37+ }
3838
39- @ Test
40- @ DisplayName ("Test the velocity addition in the same direction" )
41- void testVelocityAdditionSameDirection () {
42- double myVelocity = Relativity .velocityAddition (0.8 * C , 0.75 * C );
43- assertEquals (0.125 * C , myVelocity , DELTA );
44- }
39+ @ Test
40+ @ DisplayName ("Test the velocity addition in the same direction" )
41+ void testVelocityAdditionSameDirection () {
42+ double myVelocity = Relativity .velocityAddition (0.8 * C , 0.75 * C );
43+ assertEquals (0.125 * C , myVelocity , DELTA );
44+ }
4545
46- @ Test
47- @ DisplayName ("Test the velocity addition in different directions" )
48- void testVelocityAdditionDifferentDirections () {
49- double myVelocity = Relativity .velocityAddition (0.8 * C , -0.75 * C );
50- assertEquals (0.96875 * C , myVelocity , DELTA );
51- }
46+ @ Test
47+ @ DisplayName ("Test the velocity addition in different directions" )
48+ void testVelocityAdditionDifferentDirections () {
49+ double myVelocity = Relativity .velocityAddition (0.8 * C , -0.75 * C );
50+ assertEquals (0.96875 * C , myVelocity , DELTA );
51+ }
5252
53- @ Test
54- @ DisplayName ("Test the velocity addition with the speed of light" )
55- void testVelocityAdditionWithSpeedOfLight () {
56- double myVelocity = Relativity .velocityAddition (C , 0.7 * C );
57- assertEquals (C , myVelocity , DELTA );
58- }
53+ @ Test
54+ @ DisplayName ("Test the velocity addition with the speed of light" )
55+ void testVelocityAdditionWithSpeedOfLight () {
56+ double myVelocity = Relativity .velocityAddition (C , 0.7 * C );
57+ assertEquals (C , myVelocity , DELTA );
58+ }
5959
60- @ Test
60+ @ Test
6161 @ DisplayName ("Test invalid inputs throw exception" )
6262 void testInvalidOrbitalVelocityInputs () {
6363 assertThrows (IllegalArgumentException .class , () -> Relativity .gamma (1.2 * C ));
64- assertThrows (IllegalArgumentException .class , () -> Relativity .gamma (-C ));
64+ assertThrows (IllegalArgumentException .class , () -> Relativity .gamma (-C ));
6565 assertThrows (IllegalArgumentException .class , () -> Relativity .lengthContraction (-1.0 , 0.6 * C ));
66- assertThrows (IllegalArgumentException .class , () -> Relativity .lengthContraction (1.0 , 1.5 * C ));
66+ assertThrows (IllegalArgumentException .class , () -> Relativity .lengthContraction (1.0 , 1.5 * C ));
6767 assertThrows (IllegalArgumentException .class , () -> Relativity .timeDilation (-5.0 , -0.8 * C ));
68- assertThrows (IllegalArgumentException .class , () -> Relativity .timeDilation (5.0 , C ));
68+ assertThrows (IllegalArgumentException .class , () -> Relativity .timeDilation (5.0 , C ));
6969 assertThrows (IllegalArgumentException .class , () -> Relativity .velocityAddition (0.3 * C , -C ));
70- assertThrows (IllegalArgumentException .class , () -> Relativity .velocityAddition (1.4 * C , 0.2 * C ));
71- assertThrows (IllegalArgumentException .class , () -> Relativity .velocityAddition (-0.4 * C , 1.2 * C ));
70+ assertThrows (IllegalArgumentException .class , () -> Relativity .velocityAddition (1.4 * C , 0.2 * C ));
71+ assertThrows (IllegalArgumentException .class , () -> Relativity .velocityAddition (-0.4 * C , 1.2 * C ));
7272 }
7373}
0 commit comments