use of org.eclipse.wst.sse.core.tests.util.Accessor in project webtools.sourceediting by eclipse.
the class TestRegionList method test_iterator1.
public void test_iterator1() {
TextRegionListImpl impl = new TextRegionListImpl();
boolean added = impl.add(new ContextRegion(REGION_TYPE, 0, 1, 1));
assertTrue("region not added", added);
assertEquals("count was wrong", 1, impl.size());
added = impl.add(new ContextRegion(REGION_TYPE, 2, 1, 1));
assertTrue("region not added", added);
assertEquals("count was wrong", 2, impl.size());
Iterator it = null;
assertNotNull("no iterator returned", it = (Iterator) new Accessor(impl, TextRegionListImpl.class).invoke("iterator", new Object[0]));
assertTrue(it.hasNext());
}
use of org.eclipse.wst.sse.core.tests.util.Accessor in project webtools.sourceediting by eclipse.
the class TestRegionList method test_iterator0.
public void test_iterator0() {
TextRegionListImpl impl = new TextRegionListImpl();
Iterator it = null;
assertNotNull("no iterator returned", it = (Iterator) new Accessor(impl, TextRegionListImpl.class).invoke("iterator", new Object[0]));
assertFalse(it.hasNext());
}
use of org.eclipse.wst.sse.core.tests.util.Accessor in project webtools.sourceediting by eclipse.
the class TestRegionList method test_trimToSize0.
public void test_trimToSize0() {
ITextRegion[] regions = new ITextRegion[3];
TextRegionListImpl impl = new TextRegionListImpl();
boolean added = impl.add(regions[0] = new ContextRegion(REGION_TYPE, 0, 1, 1));
assertTrue("region not added", added);
assertEquals("count was wrong", 1, impl.size());
added = impl.add(regions[1] = new ContextRegion(REGION_TYPE, 1, 1, 1));
assertTrue("region not added", added);
assertEquals("count was wrong", 2, impl.size());
added = impl.add(regions[2] = new ContextRegion(REGION_TYPE, 2, 1, 1));
assertTrue("region not added", added);
assertEquals("count was wrong", 3, impl.size());
impl.clear();
assertEquals("count was wrong", 0, new Accessor(impl, TextRegionListImpl.class).getInt("fRegionsCount"));
impl.trimToSize();
assertEquals("count was wrong", 0, new Accessor(impl, TextRegionListImpl.class).getInt("fRegionsCount"));
assertEquals("not trimmed", 0, ((Object[]) new Accessor(impl, TextRegionListImpl.class).get("fRegions")).length);
}
Aggregations