@@ -21,11 +21,11 @@ final class GravitationTest {
2121 void testSimpleForceCalculation () {
2222 // Force on body 2 should be F = G*1*1 / 1^2 = G, directed towards body 1 (negative x)
2323 double [] forceOnB = Gravitation .calculateGravitationalForce (1.0 , 0 , 0 , 1.0 , 1 , 0 );
24- assertArrayEquals (new double []{-G , 0.0 }, forceOnB , DELTA );
24+ assertArrayEquals (new double [] {-G , 0.0 }, forceOnB , DELTA );
2525
2626 // Force on body 1 should be equal and opposite (positive x)
2727 double [] forceOnA = Gravitation .calculateGravitationalForce (1.0 , 1 , 0 , 1.0 , 0 , 0 );
28- assertArrayEquals (new double []{G , 0.0 }, forceOnA , DELTA );
28+ assertArrayEquals (new double [] {G , 0.0 }, forceOnA , DELTA );
2929 }
3030
3131 @ Test
@@ -34,20 +34,20 @@ void test2DForceCalculation() {
3434 // Body 1 at (0,0) with mass 2kg
3535 // Body 2 at (3,4) with mass 1kg
3636 // Distance is sqrt(3^2 + 4^2) = 5 meters
37- double magnitude = ( 2.0 * G ) / 25.0 ; // G * 2 * 1 / 5^2
37+ double magnitude = 2.0 * G / 25.0 ; // G * 2 * 1 / 5^2
3838 // Unit vector from 2 to 1 is (-3/5, -4/5)
39- double expectedFx = magnitude * ( -3.0 / 5.0 ) ; // -6G / 125
40- double expectedFy = magnitude * ( -4.0 / 5.0 ) ; // -8G / 125
39+ double expectedFx = magnitude * -3.0 / 5.0 ; // -6G / 125
40+ double expectedFy = magnitude * -4.0 / 5.0 ; // -8G / 125
4141
4242 double [] forceOnB = Gravitation .calculateGravitationalForce (2.0 , 0 , 0 , 1.0 , 3 , 4 );
43- assertArrayEquals (new double []{expectedFx , expectedFy }, forceOnB , DELTA );
43+ assertArrayEquals (new double [] {expectedFx , expectedFy }, forceOnB , DELTA );
4444 }
4545
4646 @ Test
4747 @ DisplayName ("Test overlapping bodies should result in zero force" )
4848 void testOverlappingBodies () {
4949 double [] force = Gravitation .calculateGravitationalForce (1000.0 , 1.5 , -2.5 , 500.0 , 1.5 , -2.5 );
50- assertArrayEquals (new double []{0.0 , 0.0 }, force , DELTA );
50+ assertArrayEquals (new double [] {0.0 , 0.0 }, force , DELTA );
5151 }
5252
5353 @ Test
0 commit comments