@Test
public void testListApplications() throws Exception {

	// Prepare
	List<Application> apps = this.client.getManagementDelegate().listApplications();
	Assert.assertNotNull( apps );
	Assert.assertEquals( 0, apps.size());
	TestApplication app = new TestApplication();
	app.setDirectory( this.folder.newFolder());
	this.managerWrapper.addManagedApplication( new ManagedApplication( app ));
	// Get ALL the applications
	apps = this.client.getManagementDelegate().listApplications();
	Assert.assertNotNull( apps );
	Assert.assertEquals( 1, apps.size());
	Application receivedApp = apps.get( 0 );
	Assert.assertEquals( app.getName(), receivedApp.getName());
	Assert.assertEquals( app.getDescription(), receivedApp.getDescription());
	// Get the "filter" application
	apps = this.client.getManagementDelegate().listApplications( "filter" );
	Assert.assertNotNull( apps );
	Assert.assertEquals( 0, apps.size());
	// Get the test application
	apps = this.client.getManagementDelegate().listApplications( app.getName());
	Assert.assertNotNull( apps );
	Assert.assertEquals( 1, apps.size());
	receivedApp = apps.get( 0 );
	Assert.assertEquals( app.getName(), receivedApp.getName());
	Assert.assertEquals( app.getDescription(), receivedApp.getDescription());
	// Tricky get
	apps = this.client.getManagementDelegate().listApplications( app.getName() + "0" );
	Assert.assertNotNull( apps );
	Assert.assertEquals( 0, apps.size());
	// Get when a session ID was set
	this.client.setSessionId( "whatever, filtering is not enabled during these tests" );
	apps = this.client.getManagementDelegate().listApplications();
	Assert.assertNotNull( apps );
	Assert.assertEquals( 1, apps.size());
}