### Question:
UIEERepositoryDirectory extends UIRepositoryDirectory implements IAclObject, java.io.Serializable { public void delete( boolean deleteHomeDirectories ) throws Exception { if ( rep instanceof RepositoryExtended ) { ( (RepositoryExtended) rep ).deleteRepositoryDirectory( getDirectory(), deleteHomeDirectories ); } else { rep.deleteRepositoryDirectory( getDirectory() ); } if ( getParent().getChildren().contains( this ) ) { getParent().getChildren().remove( this ); } if ( getParent().getRepositoryObjects().contains( this ) ) { getParent().getRepositoryObjects().remove( this ); } getParent().refresh(); } UIEERepositoryDirectory();  UIEERepositoryDirectory( RepositoryDirectoryInterface rd, UIRepositoryDirectory uiParent, Repository rep ); void getAcls( UIRepositoryObjectAcls acls, boolean forceParentInheriting ); void getAcls( UIRepositoryObjectAcls acls ); void setAcls( UIRepositoryObjectAcls security ); void delete( boolean deleteHomeDirectories ); void setName( String name, boolean renameHomeDirectories ); @Override void clearAcl(); @Override boolean hasAccess( RepositoryFilePermission perm );  }### Answer:
@Test public void testDelete() throws Exception { UIRepositoryDirectories mockUIRepositoryDirectories = mock( UIRepositoryDirectories.class ); when( mockUIRepositoryDirectories.contains( uiRepDir ) ).thenReturn( true ); when( mockParent.getChildren() ).thenReturn( mockUIRepositoryDirectories ); UIRepositoryObjects mockUIRepositoryObjects = mock( UIRepositoryObjects.class ); when( mockUIRepositoryObjects.contains( uiRepDir ) ).thenReturn( true ); when( mockParent.getRepositoryObjects() ).thenReturn( mockUIRepositoryObjects ); uiRepDir.delete( false ); verify( mockRepository ).deleteRepositoryDirectory( mockRepositoryDirectory ); verify( mockUIRepositoryDirectories, times( 1 ) ).remove( uiRepDir ); verify( mockUIRepositoryObjects, times( 1 ) ).remove( uiRepDir ); verify( mockParent, times( 1 ) ).refresh(); uiPurRepDir.delete( false ); verify( mockPurRepository ).deleteRepositoryDirectory( mockRepositoryDirectory, false ); verify( mockUIRepositoryDirectories, times( 2 ) ).remove( uiPurRepDir ); verify( mockUIRepositoryObjects, times( 2 ) ).remove( uiPurRepDir ); verify( mockParent, times( 2 ) ).refresh(); }