@Test(expected=IllegalArgumentException.class)
public void testGetRepositoryByKeyBadId() {

  when(servletContext.getClassLoader()).thenReturn(this.getClass().getClassLoader());
  Map<String, String> map = new HashMap<>();
  map.put("IN", InMemoryRepositoryFactory.class.getName());
  map.put("BAD", "com.not.existing.class.Bad");
  when(servletContext.getAttribute(Attributes.PROVIDERS)).thenReturn(map);
  SessionConfiguration sessionConfiguration = new SessionConfiguration();
  sessionConfiguration.setRepositoryFactory("BAD_ID");
  SessionHelpers.repository(servletContext, sessionConfiguration);
}