File tree 1 file changed +15
-2
lines changed
translate/src/test/java/com/google/cloud/translate/samples
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,14 @@ public class TranslateTextTest {
75
75
76
76
// Assert
77
77
String got = bout .toString ();
78
- assertThat (got ).contains ("language=en, confidence=0.79742646" );
78
+ assertThat (got ).contains ("language=en" );
79
+
80
+ // Assert
81
+ Double confidence = Double .parseDouble (
82
+ got .split ("confidence=" )[1 ].split ("}" )[0 ]
83
+ );
84
+ assertThat (confidence ).isLessThan (1.0 );
85
+ assertThat (confidence ).isGreaterThan (0.7 );
79
86
}
80
87
81
88
@ Test public void testGermanLangDetection () throws Exception {
@@ -88,8 +95,14 @@ public class TranslateTextTest {
88
95
89
96
// Assert
90
97
String got = bout .toString ();
91
- assertThat (got ).contains ("language=de, confidence=0.9293963 " );
98
+ assertThat (got ).contains ("language=de" );
92
99
100
+ // Assert
101
+ Double confidence = Double .parseDouble (
102
+ got .split ("confidence=" )[1 ].split ("}" )[0 ]
103
+ );
104
+ assertThat (confidence ).isLessThan (1.0 );
105
+ assertThat (confidence ).isGreaterThan (0.9 );
93
106
}
94
107
95
108
@ Test public void testDefaultIdentityTranslation () throws Exception {
You can’t perform that action at this time.
0 commit comments