/**
* Tests getting filtered queries.
*/
public void testGetFilteredQueries() {
DataQuery dataQueryTest = TestUtil.getFilledDataQuery();
String dimensionName = "ga:landingPagePath";
dataQueryTest.setDimensions(dimensionName);
List<String> dimensionValues = new ArrayList<String>();
String dimensionValue = "/foo";
dimensionValues.add(dimensionValue);
// Ensure list of filters is being set.
queries = queryManager.getFilteredQueries(dataQueryTest, dimensionValues);
assertNotNull(queries);
assertNotNull(queries.getFilterList());
assertEquals(dimensionValues.size(), queries.getFilterList().size());
String expectedFilter = Filter.getEqualityFilter(dimensionName, dimensionValue);
assertEquals(expectedFilter, queries.getFilterList().get(0));
// Ensure query is updated.
DataQuery resultQuery = queries.getFilteredQuery(0);
DataQuery expectedQuery = TestUtil.getFilledDataQuery();
expectedQuery.setDimensions(dimensionName);
queryManager.updateQuery(expectedQuery);
assertEquals(expectedQuery.getMaxResults(), resultQuery.getMaxResults());
assertTrue(expectedQuery.getSort().equals(resultQuery.getSort()));
String expectedDim = expectedQuery.getDimensions();
String resultDim = resultQuery.getDimensions();
assertTrue(expectedDim.equals(resultDim));
}