### Question:
StdCouchDbInstance implements CouchDbInstance { public void createDatabase(String path) { createDatabase(DbPath.fromString(path)); } StdCouchDbInstance(HttpClient client);  StdCouchDbInstance(HttpClient client, ObjectMapperFactory of); ObjectMapperFactory getObjectMapperFactory(); void createDatabase(String path); void createDatabase(DbPath db); boolean createDatabaseIfNotExists(String path); boolean createDatabaseIfNotExists(final DbPath db); void deleteDatabase(String path); @Override boolean checkIfDbExists(String path); @Override boolean checkIfDbExists(DbPath db); List<String> getAllDatabases(); ReplicationStatus replicate(ReplicationCommand cmd); HttpClient getConnection(); CouchDbConnector createConnector(String path,
			boolean createIfNotExists); @Override CouchDbConnector getReplicatorConnector(); @Override T getConfiguration(final Class<T> c); @Override T getConfiguration(final Class<T> c, String section); @Override T getConfiguration(final Class<T> c, String section, String key); @Override String getConfiguration(String section, String key); @Override String setConfiguration(String section, String key, String value); @Override String deleteConfiguration(String section, String key); @Override Collection<ActiveTask> getActiveTasks();  }### Answer:
@Test public void testCreateDatabase() { when(client.head("/testdb/")).thenReturn(HttpResponseStub.valueOf(404, "{\"error\":\"not_found\",\"reason\":\"no_db_file\"}")); when(client.put(anyString())).thenReturn(HttpResponseStub.valueOf(201, "{\"ok\": true}")); instance.createDatabase("testdb/"); verify(client).put("/testdb/"); }
@Test public void testDatabaseWithSlashInPath() { when(client.head("/test_inv%2Fqaz/")).thenReturn(HttpResponseStub.valueOf(404, "{\"error\":\"not_found\",\"reason\":\"no_db_file\"}")); when(client.put(anyString())).thenReturn(HttpResponseStub.valueOf(201, "{\"ok\": true}")); instance.createDatabase("test_inv/qaz/"); verify(client).put("/test_inv%2Fqaz/"); }
@Test public void shouldFailWhenDbExists() { when(client.get("/_all_dbs")).thenReturn(HttpResponseStub.valueOf(200, "[\"somedatabase\", \"anotherdatabase\"]")); try { instance.createDatabase("somedatabase/"); fail("RuntimeException expected"); } catch (Exception e) { } }