### Question:
AbstractBooleanPermission extends AbstractPermission<This> { public AbstractPermissionCollection newPermissionCollection() { return new BooleanPermissionCollection(this); } protected  AbstractBooleanPermission(); boolean implies(final This permission); boolean equals(final This other); int hashCode(); AbstractPermissionCollection newPermissionCollection();  }### Answer:
@Test public void testCollection() { final AbstractPermissionCollection collection = new SomePermission().newPermissionCollection(); assertEquals(0, collection.size()); collection.add(new SomePermission()); assertEquals(1, collection.size()); collection.add(new SomePermission()); assertEquals(1, collection.size()); final Iterator<Permission> iterator = collection.iterator(); assertTrue(iterator.hasNext()); assertEquals(new SomePermission(), iterator.next()); assertFalse(iterator.hasNext()); try { iterator.next(); fail("Expected exception"); } catch (NoSuchElementException ignored) {} try { collection.add(new SomeOtherPermission()); fail("Expected exception"); } catch (IllegalArgumentException ignored) {} }