@Test
public void testReturnedAttributes() throws Exception {

    logger.info("Running testReturnedAttributes ...");
    ArrayList<String> toRetainFst = new ArrayList<String>();
    toRetainFst.add("str1");
    ArrayList<String> toRetainSnd = new ArrayList<String>();
    toRetainSnd.add("str2");
    SimpleFeatureCollection output2 = process.execute(zonesCollection, featuresCollection,toRetainFst,toRetainSnd, IntersectionMode.INTERSECTION, true, true);
    System.out.println("count "+output2.getSchema().getAttributeCount());
    assertNotNull(output2.getSchema().getDescriptor("the_geom"));
    assertNotNull(output2.getSchema().getDescriptor("zones_str1"));
    assertNotNull(output2.getSchema().getDescriptor("features_str2"));
    assertNotNull(output2.getSchema().getDescriptor("percentageA"));
    assertNotNull(output2.getSchema().getDescriptor("percentageB"));
    assertNotNull(output2.getSchema().getDescriptor("areaA"));
    assertNotNull(output2.getSchema().getDescriptor("areaB"));
    assertNotNull(output2.getSchema().getDescriptor("INTERSECTION_ID"));
    assertTrue(output2.getSchema().getAttributeCount()==8);
    SimpleFeatureIterator sfTemp2 = output2.features();
    sfTemp2.hasNext();
    SimpleFeature sf = sfTemp2.next();
    // test with both area and percentage attributes
    assertNotNull(sf.getAttribute("the_geom"));
    assertNotNull(sf.getAttribute("zones_str1"));
    assertNotNull(sf.getAttribute("features_str2"));
    assertNotNull(sf.getAttribute("percentageA"));
    assertNotNull(sf.getAttribute("percentageB"));
    assertNotNull(sf.getAttribute("areaA"));
    assertNotNull(sf.getAttribute("areaB"));
    assertTrue(sf.getAttributeCount()==8);
    // test without area and percentageAttributes
    SimpleFeatureCollection output3 = process.execute(zonesCollection, featuresCollection,toRetainFst,toRetainSnd, IntersectionMode.INTERSECTION, false, false);
    SimpleFeatureIterator sfTemp3 = output3.features();
    sfTemp3.hasNext();
    SimpleFeature sf2 = sfTemp3.next();
    assertNotNull(sf2.getAttribute("the_geom"));
    assertNotNull(sf2.getAttribute("zones_str1"));
    assertNotNull(sf2.getAttribute("features_str2"));
    assertTrue(sf2.getAttributeCount()==4);
}