Skip to content

Commit e3fd5b8

Browse files
fix: change formality tests to look for text containing "dir" or "Ihnen" for German formality, rather than depending on exact translation
1 parent c84587e commit e3fd5b8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

deepl-java/src/test/java/com/deepl/api/TranslateDocumentTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void testTranslateDocumentFormality() throws Exception {
9494
"de",
9595
new DocumentTranslationOptions().setFormality(Formality.More));
9696
if (!isMockServer) {
97-
Assertions.assertEquals("Wie geht es Ihnen?", readFromFile(outputFile));
97+
Assertions.assertTrue(readFromFile(outputFile).contains("Ihnen"));
9898
}
9999

100100
outputFile.delete();
@@ -106,7 +106,7 @@ void testTranslateDocumentFormality() throws Exception {
106106
"de",
107107
new DocumentTranslationOptions().setFormality(Formality.Less));
108108
if (!isMockServer) {
109-
Assertions.assertEquals("Wie geht es dir?", readFromFile(outputFile));
109+
Assertions.assertTrue(readFromFile(outputFile).contains("dir"));
110110
}
111111
}
112112

deepl-java/src/test/java/com/deepl/api/TranslateTextTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void testFormality() throws DeepLException, InterruptedException {
146146
translator.translateText(
147147
"How are you?", null, "de", new TextTranslationOptions().setFormality(Formality.Less));
148148
if (!isMockServer) {
149-
Assertions.assertEquals("Wie geht es dir?", result.getText());
149+
Assertions.assertTrue(result.getText().contains("dir"));
150150
}
151151

152152
result =
@@ -156,14 +156,14 @@ void testFormality() throws DeepLException, InterruptedException {
156156
"de",
157157
new TextTranslationOptions().setFormality(Formality.Default));
158158
if (!isMockServer) {
159-
Assertions.assertEquals("Wie geht es Ihnen?", result.getText());
159+
Assertions.assertTrue(result.getText().contains("Ihnen"));
160160
}
161161

162162
result =
163163
translator.translateText(
164164
"How are you?", null, "de", new TextTranslationOptions().setFormality(Formality.More));
165165
if (!isMockServer) {
166-
Assertions.assertEquals("Wie geht es Ihnen?", result.getText());
166+
Assertions.assertTrue(result.getText().contains("Ihnen"));
167167
}
168168

169169
result =
@@ -173,7 +173,7 @@ void testFormality() throws DeepLException, InterruptedException {
173173
"de",
174174
new TextTranslationOptions().setFormality(Formality.PreferLess));
175175
if (!isMockServer) {
176-
Assertions.assertEquals("Wie geht es dir?", result.getText());
176+
Assertions.assertTrue(result.getText().contains("dir"));
177177
}
178178

179179
result =
@@ -183,7 +183,7 @@ void testFormality() throws DeepLException, InterruptedException {
183183
"de",
184184
new TextTranslationOptions().setFormality(Formality.PreferMore));
185185
if (!isMockServer) {
186-
Assertions.assertEquals("Wie geht es Ihnen?", result.getText());
186+
Assertions.assertTrue(result.getText().contains("Ihnen"));
187187
}
188188
}
189189

0 commit comments

Comments
 (0)