Skip to content

Commit 001f400

Browse files
committed
added within instead of less and greater than for test
1 parent 91c0ee9 commit 001f400

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

translate/src/test/java/com/google/cloud/translate/samples/TranslateTextTest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public class TranslateTextTest {
8181
Double confidence = Double.parseDouble(
8282
got.split("confidence=")[1].split("}")[0]
8383
);
84-
assertThat(confidence).isLessThan(1.0);
85-
assertThat(confidence).isGreaterThan(0.7);
84+
assertThat(confidence).isWithin(0.7).of(1.0);
8685
}
8786

8887
@Test public void testGermanLangDetection() throws Exception {
@@ -101,8 +100,7 @@ public class TranslateTextTest {
101100
Double confidence = Double.parseDouble(
102101
got.split("confidence=")[1].split("}")[0]
103102
);
104-
assertThat(confidence).isLessThan(1.0);
105-
assertThat(confidence).isGreaterThan(0.9);
103+
assertThat(confidence).isWithin(0.9).of(1.0);
106104
}
107105

108106
@Test public void testDefaultIdentityTranslation() throws Exception {

0 commit comments

Comments
 (0)