File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
src/test/java/org/scijava/prefs Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -175,4 +175,24 @@ public void testList() {
175175 assertEquals (recentFiles , result );
176176 }
177177
178+ /**
179+ * The Java Preferences API does not support keys longer than 80 characters.
180+ * Let's test that our service does not fall victim to this limitation.
181+ */
182+ @ Test
183+ public void testLongKeys () {
184+ final String longKey = "" + //
185+ "abcdefghijklmnopqrstuvwxyz" + //
186+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + //
187+ "0123456789" + //
188+ "9876543210" + //
189+ "ZYXWVUTSRQPONMLKJIHGFEDCBA" + //
190+ "zyxwvutsrqponmlkjihgfedcba" ;
191+ final String lyrics =
192+ "Now I know my ABC's. Next time won't you sing with me?" ;
193+ prefService .put (longKey , lyrics );
194+ final String recovered = prefService .get (longKey );
195+ assertEquals (lyrics , recovered );
196+ }
197+
178198}
You can’t perform that action at this time.
0 commit comments