### Question:
StorageLocationManagerImpl implements StorageLocationManager { @Override public StorageLocation getStorageLocationForUri(URI uri) { URI normalizedUri = uri.normalize(); return storageLocations.stream() .filter(sl -> sl.isValidUri(normalizedUri)) .findFirst() .orElseThrow(() -> new UnknownStorageLocationException( "No configured storage locations matched " + uri)); } StorageLocationManagerImpl(); void init(); @Override StorageLocation getDefaultStorageLocation(PID pid); @Override List<StorageLocation> listAvailableStorageLocations(PID pid); @Override StorageLocation getStorageLocation(PID pid); @Override StorageLocation getStorageLocation(RepositoryObject repoObj); @Override StorageLocation getStorageLocationById(String id); @Override StorageLocation getStorageLocationForUri(URI uri); void setPathFactory(ContentPathFactory pathFactory); void setRepositoryObjectLoader(RepositoryObjectLoader repositoryObjectLoader); void setConfigPath(String configPath); void setMappingPath(String mappingPath);  }### Answer:
@Test public void getStorageLocationForUriMatchingUris() throws Exception { helper.addStorageLocation(LOC1_ID, LOC1_NAME, LOC1_BASE); helper.addStorageLocation(LOC2_ID, LOC2_NAME, LOC2_BASE); initializeManager(); assertIsLocation1(locManager.getStorageLocationForUri(URI.create(LOC1_BASE + "/sub/file"))); assertIsLocation2(locManager.getStorageLocationForUri(URI.create(LOC2_BASE + "/other/path"))); }
@Test(expected = UnknownStorageLocationException.class) public void getStorageLocationForUriParentUri() throws Exception { helper.addStorageLocation(LOC1_ID, LOC1_NAME, LOC1_BASE); initializeManager(); locManager.getStorageLocationForUri(URI.create("file: }
@Test(expected = UnknownStorageLocationException.class) public void getStorageLocationForUriNoMatching() throws Exception { helper.addStorageLocation(LOC1_ID, LOC1_NAME, LOC1_BASE); initializeManager(); locManager.getStorageLocationForUri(URI.create("file: }