@@ -86,23 +86,23 @@ public void versionIsPreservedOnRoundTrip() {
8686 assertThat (ResumptionTokens .decode (token ).getVersion (), is (1 ));
8787 }
8888
89+ // ---- large keys -----------------------------------------------------------
90+
91+ @ Test
92+ public void roundTripsLongKeys () {
93+ String key = new String (new char [5000 ]).replace ('\0' , 'a' );
94+ String token = ResumptionTokens .encode ("run" , key , null , 1 , null );
95+ ResumptionTokens .Decoded d = ResumptionTokens .decode (token );
96+ assertThat (d .getConfigKey (), is (key ));
97+ }
98+
8999 // ---- decode error handling ------------------------------------------------
90100
91101 @ Test (expected = IllegalArgumentException .class )
92102 public void decodeRejectsNull () {
93103 ResumptionTokens .decode (null );
94104 }
95105
96- @ Test (expected = IllegalArgumentException .class )
97- public void decodeRejectsOversizedToken () {
98- // Build a token larger than 4096 bytes
99- String largeValue = new String (new char [5000 ]).replace ('\0' , 'x' );
100- String json = "{\" runId\" :\" " + largeValue + "\" ,\" configKey\" :\" c\" ,\" version\" :1}" ;
101- String token = java .util .Base64 .getUrlEncoder ().withoutPadding ()
102- .encodeToString (json .getBytes (java .nio .charset .StandardCharsets .UTF_8 ));
103- ResumptionTokens .decode (token );
104- }
105-
106106 @ Test (expected = IllegalArgumentException .class )
107107 public void decodeRejectsInvalidBase64 () {
108108 ResumptionTokens .decode ("not-valid-base64!!!!" );
0 commit comments