PrivilegeImpl implements Privilege { @Override public Privilege[] getAggregatePrivileges() { ArrayList<Privilege> list = new ArrayList<Privilege>(); for (Privilege ap : getDeclaredAggregatePrivileges()) { aggregate(list, ap); } Privilege[] res = new Privilege[list.size()]; list.toArray(res); return res; } PrivilegeImpl(Session session, String name, Privilege[] declaredPrivileges);  PrivilegeImpl(Session session, String name, Privilege[] declaredPrivileges, boolean isAbstract); String localName(); @Override String getName(); @Override boolean isAbstract(); @Override boolean isAggregate(); @Override Privilege[] getDeclaredAggregatePrivileges(); @Override Privilege[] getAggregatePrivileges(); boolean contains(Privilege p); @Override String toString(); @Override boolean equals(Object other); @Override int hashCode();  }
@Test public void testGetAggregatePrivileges() { Privilege[] pp = p4.getAggregatePrivileges(); assertEquals(3, pp.length); assertTrue(contains(p1, pp)); assertTrue(contains(p2, pp)); assertTrue(contains(p3, pp)); }