@Test public void buildNullFilterTest() throws Exception { MongoConnectionHandler connectionHandler = Mockito.mock(MongoConnectionHandler.class); Connection<MongoClient> connection = Mockito.mock(Connection.class); MongoClient client = Mockito.mock(MongoClient.class); DB database = Mockito.mock(DB.class); DBCollection collection = Mockito.mock(DBCollection.class); MongoStorageEngine mongoStorageEngine; when(connectionHandler.getConnection(CLUSTER_NAME)).thenReturn(connection); when(connection.getNativeConnection()).thenReturn(client); mongoStorageEngine = MongoStorageEngine.getInstance((MongoConnectionHandler) connectionHandler); when(client.getDB(DB_NAME)).thenReturn(database); when(client.getDB(DB_NAME)).thenReturn(database); when(database.getCollection(COLLECTION_NAME)).thenReturn(collection); Method method = mongoStorageEngine.getClass().getDeclaredMethod("buildFilter", Collection.class); method.setAccessible(true); DBObject filter = (DBObject) method.invoke(mongoStorageEngine, (Collection<Filter>) null); Assert.assertEquals("If there is no filters the query has to match all", new BasicDBObject(), filter); }
public static MongoStorageEngine getInstance(MongoConnectionHandler connectionHandler){ if(instance == null){ instance = new MongoStorageEngine(connectionHandler); } return instance; }
MongoStorageEngine extends CommonsStorageEngine<MongoClient> { public static MongoStorageEngine getInstance(MongoConnectionHandler connectionHandler){ if(instance == null){ instance = new MongoStorageEngine(connectionHandler); } return instance; } }
MongoStorageEngine extends CommonsStorageEngine<MongoClient> { public static MongoStorageEngine getInstance(MongoConnectionHandler connectionHandler){ if(instance == null){ instance = new MongoStorageEngine(connectionHandler); } return instance; } private  MongoStorageEngine(MongoConnectionHandler connectionHandler); }
MongoStorageEngine extends CommonsStorageEngine<MongoClient> { public static MongoStorageEngine getInstance(MongoConnectionHandler connectionHandler){ if(instance == null){ instance = new MongoStorageEngine(connectionHandler); } return instance; } private  MongoStorageEngine(MongoConnectionHandler connectionHandler); static MongoStorageEngine getInstance(MongoConnectionHandler connectionHandler); }
MongoStorageEngine extends CommonsStorageEngine<MongoClient> { public static MongoStorageEngine getInstance(MongoConnectionHandler connectionHandler){ if(instance == null){ instance = new MongoStorageEngine(connectionHandler); } return instance; } private  MongoStorageEngine(MongoConnectionHandler connectionHandler); static MongoStorageEngine getInstance(MongoConnectionHandler connectionHandler);  }