@@ -159,6 +159,49 @@ void sendsAllDocumentOptionsInOrder() throws Exception {
159159 "output_format" );
160160 }
161161
162+ @ Test
163+ void sendsEnableWatermarkWithOutputFormat () throws Exception {
164+ File input = writeInput ("example.txt" , "a" );
165+ expectUpload (
166+ "/v2/document" ,
167+ "example.txt" ,
168+ "a" .getBytes (StandardCharsets .UTF_8 ),
169+ fields ("target_lang" , "de" , "output_format" , "docx" , "enable_watermark" , "true" ));
170+ client .translateDocumentUpload (
171+ input ,
172+ null ,
173+ "de" ,
174+ new DocumentTranslationOptions ().setOutputFormat ("docx" ).setEnableWatermark (true ));
175+ assertPartNames ("/v2/document" , "file" , "target_lang" , "output_format" , "enable_watermark" );
176+ }
177+
178+ @ Test
179+ void sendsEnableWatermarkFalseWhenExplicitlyDisabled () throws Exception {
180+ File input = writeInput ("example.txt" , "a" );
181+ expectUpload (
182+ "/v2/document" ,
183+ "example.txt" ,
184+ "a" .getBytes (StandardCharsets .UTF_8 ),
185+ fields ("target_lang" , "de" , "enable_watermark" , "false" ));
186+ client .translateDocumentUpload (
187+ input , null , "de" , new DocumentTranslationOptions ().setEnableWatermark (false ));
188+ assertPartNames ("/v2/document" , "file" , "target_lang" , "enable_watermark" );
189+ }
190+
191+ @ Test
192+ void omitsEnableWatermarkWhenUnset () throws Exception {
193+ File input = writeInput ("example.txt" , "a" );
194+ DocumentTranslationOptions options = new DocumentTranslationOptions ().setOutputFormat ("docx" );
195+ assertNull (options .getEnableWatermark ());
196+ expectUpload (
197+ "/v2/document" ,
198+ "example.txt" ,
199+ "a" .getBytes (StandardCharsets .UTF_8 ),
200+ fields ("target_lang" , "de" , "output_format" , "docx" ));
201+ client .translateDocumentUpload (input , null , "de" , options );
202+ assertPartNames ("/v2/document" , "file" , "target_lang" , "output_format" );
203+ }
204+
162205 @ Test
163206 void sendsGlossaryIdsJoinedByCommaAndExtraBodyParametersLast () throws Exception {
164207 File input = writeInput ("example.txt" , "a" );
@@ -350,6 +393,23 @@ void uploadsPollsAndDownloadsWhenTranslatingAFile() throws Exception {
350393 assertEquals ("Protonenstrahl" , Fixtures .readFile (output ));
351394 }
352395
396+ @ Test
397+ void sendsEnableWatermarkWhenTranslatingAFile () throws Exception {
398+ File input = writeInput ("example.txt" , "a" );
399+ File output = tempDir .resolve ("out.txt" ).toFile ();
400+ expectUpload (
401+ "/v2/document/" ,
402+ "example.txt" ,
403+ "a" .getBytes (StandardCharsets .UTF_8 ),
404+ fields ("target_lang" , "de" , "enable_watermark" , "true" ));
405+ wm .stubFor (post ("/v2/document/D1" ).willReturn (okJson (DONE )));
406+ wm .stubFor (
407+ post ("/v2/document/D1/result" ).willReturn (aResponse ().withStatus (200 ).withBody ("b" )));
408+ client .translateDocument (
409+ input , output , null , "de" , new DocumentTranslationOptions ().setEnableWatermark (true ));
410+ assertPartNames ("/v2/document/" , "file" , "target_lang" , "enable_watermark" );
411+ }
412+
353413 @ Test
354414 void uploadsStreamsToThePathWithATrailingSlashWhenTranslatingStreams () throws Exception {
355415 expectUpload (
0 commit comments