RandomIdNoLuhnProvider implements SessionIdProvider { @Override public String readId(String value) { if (value == null) { return null; } String trimmedValue = value.trim(); if (trimmedValue.isEmpty()) { return null; } if (trimmedValue.length() != getLengthInCharacters()) { return null; } return trimmedValue; } RandomIdNoLuhnProvider();   RandomIdNoLuhnProvider(int length); @Override String newId(); @Override String readId(String value); @Override void configure(SessionConfiguration configuration);  }
@Test public void testReadId() { RandomIdNoLuhnProvider provider = new RandomIdNoLuhnProvider(); assertNull(provider.readId("ABCDEFG")); assertNull(provider.readId("")); assertNull(provider.readId(null)); assertEquals("ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE", provider.readId("ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDE")); }