Skip to content

Commit 10b4252

Browse files
dkapilEugen
authored andcommitted
BAEL-9683 Fix tutorials default-first build - ref# 156 (eugenp#5491)
* BAEL-9683 Fix tutorials default-first build - ref# 156 - Fix assertion error - loss of precision was happening because double was being divided by an integer * BAEL-9683 Fix tutorials default-first build - ref# 156 - Fixed formatting
1 parent 070bc10 commit 10b4252

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.baeldung.maths;
22

3-
import static org.junit.Assert.assertTrue;
3+
import static org.hamcrest.CoreMatchers.is;
4+
import static org.junit.Assert.assertThat;
45

56
import org.junit.jupiter.api.Test;
67

@@ -11,10 +12,10 @@ public void givenAnAngleInDegrees_whenUsingToRadians_thenResultIsInRadians() {
1112
double angleInDegrees = 30;
1213
double sinForDegrees = Math.sin(Math.toRadians(angleInDegrees)); // 0.5
1314

14-
double thirtyDegreesInRadians = 1/6 * Math.PI;
15+
double thirtyDegreesInRadians = (double) 1 / 6 * Math.PI;
1516
double sinForRadians = Math.sin(thirtyDegreesInRadians); // 0.5
1617

17-
assertTrue(sinForDegrees == sinForRadians);
18+
assertThat(sinForDegrees, is(sinForRadians));
1819
}
1920

2021
}

0 commit comments

Comments
 (0)