### Question:
GeoGigDataStoreFactory implements DataStoreFactorySpi { public @Override GeoGigDataStore createDataStore(Map<String, Serializable> params) throws IOException { final String repositoryLocation = (String) REPOSITORY.lookUp(params); @Nullable final String defaultNamespace = (String) DEFAULT_NAMESPACE.lookUp(params); @Nullable final String branch = (String) BRANCH.lookUp(params); @Nullable final String head = (String) HEAD.lookUp(params); @Nullable final String effectiveHead = (head == null) ? branch : head; final URI repositoryUri = resolveURI(repositoryLocation); Repository repo; try { repo = Geogig.open(repositoryUri).getRepository(); } catch (RepositoryConnectionException | RuntimeException e) { throw new IOException(e.getMessage(), e); } GeoGigDataStore store = new GeoGigDataStore(repo); if (defaultNamespace != null) { store.setNamespaceURI(defaultNamespace); } if (effectiveHead != null) { store.setHead(effectiveHead); } return store; }  @Override String getDisplayName(); @Override String getDescription(); @Override Param[] getParametersInfo(); @Override boolean canProcess(Map<String, Serializable> params); @Override boolean isAvailable(); @Override Map<Key, ?> getImplementationHints(); @Override GeoGigDataStore createDataStore(Map<String, Serializable> params); @Override GeoGigDataStore createNewDataStore(Map<String, Serializable> params); static final String DISPLAY_NAME; static final Param REPOSITORY; static final Param BRANCH; static final Param HEAD; static final Param DEFAULT_NAMESPACE; static final Param AUTO_INDEXING; }### Answer:
@Test public void testCreateDataStoreNonExistentRepository() throws IOException { Map<String, Serializable> params; params = ImmutableMap.of(REPOSITORY.key, repoURI.resolve("nonexistent")); try { factory.createDataStore(params); fail("Expectd IOE on non existing repository"); } catch (IOException e) { assertTrue(e.getMessage(), e.getMessage().contains("not a geogig repository")); } }
@Test public void testCreateDataStore() throws IOException { Map<String, Serializable> params; params = ImmutableMap.of(REPOSITORY.key, repoURI); GeoGigDataStore store = factory.createDataStore(params); assertNotNull(store); store.dispose(); }