RandomIdNoLuhnProvider implements SessionIdProvider { @Override public void configure(SessionConfiguration configuration) { String sessionIdLength = configuration.getAttribute(SESSION_ID_LENGTH, DEFAULT_SESSION_ID_LENGTH); length = Integer.parseInt(sessionIdLength); } RandomIdNoLuhnProvider();   RandomIdNoLuhnProvider(int length); @Override String newId(); @Override String readId(String value); @Override void configure(SessionConfiguration configuration);  }
@Test public void testConfigure() { SessionConfiguration conf = mock(SessionConfiguration.class); when(conf.getAttribute(eq(SessionConfiguration.SESSION_ID_LENGTH), any(String.class))).thenReturn("43"); RandomIdNoLuhnProvider provider = new RandomIdNoLuhnProvider(); provider.configure(conf); assertEquals(60, provider.newId().length()); assertEquals("ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEabcde_____1234567890", provider.readId("ABCDEABCDEABCDEABCDEABCDEABCDEABCDEABCDEabcde_____1234567890")); }