File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
deepl-java/src/test/java/com/deepl/api Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,21 @@ void testUsage() throws DeepLException, InterruptedException {
8686 Assertions .assertTrue (usage .toString ().contains ("Usage this billing period" ));
8787 }
8888
89+ @ Test
90+ void testUsageLarge () throws DeepLException , InterruptedException {
91+ Assumptions .assumeTrue (isMockServer );
92+ SessionOptions sessionOptions = new SessionOptions ();
93+ sessionOptions .initCharacterLimit = 1000000000000L ;
94+ Map <String , String > headers = sessionOptions .createSessionHeaders ();
95+
96+ TranslatorOptions options = new TranslatorOptions ().setHeaders (headers ).setServerUrl (serverUrl );
97+ String authKeyWithUuid = authKey + "/" + UUID .randomUUID ().toString ();
98+ Translator translator = new Translator (authKeyWithUuid , options );
99+ Usage usage = translator .getUsage ();
100+ Assertions .assertNotNull (usage .getCharacter ());
101+ Assertions .assertEquals (sessionOptions .initCharacterLimit , usage .getCharacter ().getLimit ());
102+ }
103+
89104 @ Test
90105 void testGetSourceAndTargetLanguages () throws DeepLException , InterruptedException {
91106 Translator translator = createTranslator ();
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ public class SessionOptions {
1212 // Mock server session options
1313 public Integer noResponse ;
1414 public Integer respondWith429 ;
15- public Integer initCharacterLimit ;
16- public Integer initDocumentLimit ;
17- public Integer initTeamDocumentLimit ;
15+ public Long initCharacterLimit ;
16+ public Long initDocumentLimit ;
17+ public Long initTeamDocumentLimit ;
1818 public Integer documentFailure ;
1919 public Duration documentQueueTime ;
2020 public Duration documentTranslateTime ;
@@ -76,17 +76,17 @@ public SessionOptions setRespondWith429(int respondWith429) {
7676 return this ;
7777 }
7878
79- public SessionOptions setInitCharacterLimit (int initCharacterLimit ) {
79+ public SessionOptions setInitCharacterLimit (long initCharacterLimit ) {
8080 this .initCharacterLimit = initCharacterLimit ;
8181 return this ;
8282 }
8383
84- public SessionOptions setInitDocumentLimit (int initDocumentLimit ) {
84+ public SessionOptions setInitDocumentLimit (long initDocumentLimit ) {
8585 this .initDocumentLimit = initDocumentLimit ;
8686 return this ;
8787 }
8888
89- public SessionOptions setInitTeamDocumentLimit (int initTeamDocumentLimit ) {
89+ public SessionOptions setInitTeamDocumentLimit (long initTeamDocumentLimit ) {
9090 this .initTeamDocumentLimit = initTeamDocumentLimit ;
9191 return this ;
9292 }
You can’t perform that action at this time.
0 commit comments