Application extends AbstractApplication implements Serializable { public void removeAssociationWithTemplate() { if( this.template != null ) this.template.removeApplicationAssocation( this ); } Application( ApplicationTemplate template );  Application( String name, ApplicationTemplate template ); ApplicationTemplate getTemplate(); @Override Graphs getGraphs(); Map<String,String> getExternalExports(); @Override boolean equals( Object obj ); @Override int hashCode(); Application name( String name ); Application description( String description ); Application directory( File directory ); void removeAssociationWithTemplate(); void bindWithApplication( String externalExportPrefix, String applicationName ); boolean unbindFromApplication( String externalExportPrefix, String applicationName ); boolean replaceApplicationBindings( String externalExportPrefix, Set<String> applicationNames ); Map<String,Set<String>> getApplicationBindings();  }
@Test public void testAssociations() { ApplicationTemplate tpl = new ApplicationTemplate(); Assert.assertEquals( 0, tpl.getAssociatedApplications().size()); Application app1 = new Application( "1", tpl ); Assert.assertEquals( 1, tpl.getAssociatedApplications().size()); Application app2 = new Application( "2", tpl ); Assert.assertEquals( 2, tpl.getAssociatedApplications().size()); app1.removeAssociationWithTemplate(); Assert.assertEquals( 1, tpl.getAssociatedApplications().size()); app2.removeAssociationWithTemplate(); Assert.assertEquals( 0, tpl.getAssociatedApplications().size()); app1.removeAssociationWithTemplate(); Application app3 = new Application( null ); app3.removeAssociationWithTemplate(); }