File tree 2 files changed +21
-6
lines changed
deepl-java/src/test/java/com/deepl/api
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 {
86
86
Assertions .assertTrue (usage .toString ().contains ("Usage this billing period" ));
87
87
}
88
88
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
+
89
104
@ Test
90
105
void testGetSourceAndTargetLanguages () throws DeepLException , InterruptedException {
91
106
Translator translator = createTranslator ();
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ public class SessionOptions {
12
12
// Mock server session options
13
13
public Integer noResponse ;
14
14
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 ;
18
18
public Integer documentFailure ;
19
19
public Duration documentQueueTime ;
20
20
public Duration documentTranslateTime ;
@@ -76,17 +76,17 @@ public SessionOptions setRespondWith429(int respondWith429) {
76
76
return this ;
77
77
}
78
78
79
- public SessionOptions setInitCharacterLimit (int initCharacterLimit ) {
79
+ public SessionOptions setInitCharacterLimit (long initCharacterLimit ) {
80
80
this .initCharacterLimit = initCharacterLimit ;
81
81
return this ;
82
82
}
83
83
84
- public SessionOptions setInitDocumentLimit (int initDocumentLimit ) {
84
+ public SessionOptions setInitDocumentLimit (long initDocumentLimit ) {
85
85
this .initDocumentLimit = initDocumentLimit ;
86
86
return this ;
87
87
}
88
88
89
- public SessionOptions setInitTeamDocumentLimit (int initTeamDocumentLimit ) {
89
+ public SessionOptions setInitTeamDocumentLimit (long initTeamDocumentLimit ) {
90
90
this .initTeamDocumentLimit = initTeamDocumentLimit ;
91
91
return this ;
92
92
}
You can’t perform that action at this time.
0 commit comments