@Test(expected = NoResourceException.class) public void getDbInfo_dbNotExist_exception() { String dbName = "mazha_test_getdbinfo_dbnotexist"; CouchClient customClient = new CouchClient(getCouchConfig(dbName)); Preconditions.checkArgument(!isDbExist(dbName), "%s must not exist", dbName); customClient.getDbInfo(); }
private boolean isDbExist(String dbName) { try { CouchClient c = new CouchClient(getCouchConfig(dbName)); c.getDbInfo(); return true; } catch (CouchException ce) { return false; } }
@Test(expected = CouchException.class) public void getDbInfo_invalidDbName_exception() { String dbName = "mazha_test_A"; CouchClient customClient = new CouchClient(getCouchConfig(dbName)); customClient.getDbInfo(); }