@Test
public void testExtractRepositoryIdFromRequest() {

  assertEquals(none(""), repositoryId(req("http://localhost:8080/oaipmh"), "/oaipmh"));
  assertEquals(none(""), repositoryId(req("http://localhost:8080//oaipmh/"), "/oaipmh"));
  assertEquals(some("default"), repositoryId(req("http://localhost:8080//oaipmh/default"), "/oaipmh"));
  assertEquals(some("default"), repositoryId(req("http://localhost:8080//oaipmh/default/"), "/oaipmh"));
  assertEquals(some("oai"), repositoryId(req("http://localhost:8080//oai/default"), "/oaipmh"));
  assertEquals(some("default"), repositoryId(req("http://localhost:8080//oaipmh/default/more/path"), "/oaipmh"));
  assertEquals(none(""), repositoryId(req("http://localhost:8080"), "/oaipmh"));
  assertEquals(none(""), repositoryId(req("http://localhost:8080/"), "/oaipmh"));
  assertEquals(none(""), repositoryId(req("http://localhost:8080/"), "/"));
  assertEquals(none(""), repositoryId(req("http://localhost:8080/"), ""));
}