### Question:
MongoDBManager implements DBManager { @SuppressWarnings("unchecked") protected void storeObject(Object object, String collectionName) throws IOException { String json = constructDbId(object); Map<String, Object> result = new ObjectMapper().readValue(json, Map.class); BasicDBObject dbObject = new BasicDBObject(result); DBCollection coll = db.getCollection(collectionName); coll.insert(dbObject); log.debug("dbObject:", result); } MongoDBManager(); @Override void storeClientCredentials(ClientCredentials clientCreds); @SuppressWarnings("unchecked") @Override ClientCredentials findClientCredentials(String clientId); @Override void storeAuthCode(AuthCode authCode); @SuppressWarnings("unchecked") @Override AuthCode findAuthCode(String authCode, String redirectUri); @Override void storeAccessToken(AccessToken accessToken); @SuppressWarnings("unchecked") @Override AccessToken findAccessToken(String accessToken); @SuppressWarnings("unchecked") @Override AccessToken findAccessTokenByRefreshToken(String refreshToken, String clientId); @Override void updateAccessTokenValidStatus(String accessToken, boolean valid); @Override void updateAuthCodeValidStatus(String authCode, boolean valid); @Override boolean validClient(String clientId, String clientSecret); @Override @SuppressWarnings("unchecked") boolean storeScope(Scope scope); @Override @SuppressWarnings("unchecked") List<Scope> getAllScopes(); @Override @SuppressWarnings("unchecked") Scope findScope(String scopeName); @Override boolean updateClientApp(String clientId, String scope, String description, Integer status, Map<String, String> applicationDetails); @Override @SuppressWarnings("unchecked") List<ApplicationInfo> getAllApplications(); @Override boolean deleteScope(String scopeName); @Override @SuppressWarnings("unchecked") List<AccessToken> getAccessTokenByUserIdAndClientApp(String userId, String clientId); @Override void removeUserTokens(String userId); @Override void removeAccessToken(String accessToken);  }### Answer:
@Test public void when_insert_client_credentials_invoke_insert_on_collection() throws Exception { ClientCredentials cred = new ClientCredentials("Test", "basic", "descr", "http: given(db.getCollection(MongoDBManager.CLIENTS_COLLECTION_NAME)).willReturn(coll); dbManager.storeObject(cred, MongoDBManager.CLIENTS_COLLECTION_NAME); verify(coll).insert(any(DBObject.class)); }