use of org.activityinfo.shared.report.model.Dimension in project activityinfo by bedatadriven.
the class PivotSitesHandlerLocalTest method testLinkedAttributegroupFilterDataForIndicator.
@Test
@OnDataSet("/dbunit/sites-linked.db.xml")
public void testLinkedAttributegroupFilterDataForIndicator() {
withAttributeGroupDim();
forFilterData();
Dimension dim = new Dimension(DimensionType.AttributeGroup);
// empty
filter.addRestriction(DimensionType.Indicator, 100);
execute();
assertThat().thereAre(0).buckets();
// cause, contenu du kit
filter = new Filter();
filter.addRestriction(DimensionType.Indicator, 1);
execute();
assertThat().thereAre(2).buckets();
Bucket bucket1 = findBucketsByCategory(buckets, dim, new EntityCategory(1)).get(0);
assertEquals("cause", bucket1.getCategory(dim).getLabel());
assertEquals(0, (int) bucket1.doubleValue());
Bucket bucket2 = findBucketsByCategory(buckets, dim, new EntityCategory(2)).get(0);
assertEquals("contenu du kit", bucket2.getCategory(dim).getLabel());
assertEquals(0, (int) bucket2.doubleValue());
// cause
filter = new Filter();
filter.addRestriction(DimensionType.Indicator, 2);
execute();
assertThat().thereAre(1).buckets();
bucket1 = findBucketsByCategory(buckets, dim, new EntityCategory(1)).get(0);
assertEquals("cause", bucket1.getCategory(dim).getLabel());
assertEquals(0, (int) bucket1.doubleValue());
// cause, contenu du kit
filter = new Filter();
filter.addRestriction(DimensionType.Indicator, Arrays.asList(1, 2, 100));
execute();
assertThat().thereAre(2).buckets();
bucket1 = findBucketsByCategory(buckets, dim, new EntityCategory(1)).get(0);
assertEquals("cause", bucket1.getCategory(dim).getLabel());
assertEquals(0, (int) bucket1.doubleValue());
bucket2 = findBucketsByCategory(buckets, dim, new EntityCategory(2)).get(0);
assertEquals("contenu du kit", bucket2.getCategory(dim).getLabel());
assertEquals(0, (int) bucket2.doubleValue());
}
Aggregations