ApplicationTemplateMngrImpl implements IApplicationTemplateMngr { @Override public ApplicationTemplate findTemplate( String name, String version ) { ApplicationTemplate result = null; for( ApplicationTemplate tpl : this.templates.keySet()) { if( Objects.equals( tpl.getName(), name ) && Objects.equals( tpl.getVersion(), version )) { result = tpl; break; } } return result; } ApplicationTemplateMngrImpl(
			INotificationMngr notificationMngr,
			ITargetsMngr targetsMngr,
			IApplicationMngr applicationMngr,
			IConfigurationMngr configurationMngr ); @Override Set<ApplicationTemplate> getApplicationTemplates(); @Override ApplicationTemplate findTemplate( String name, String version ); @Override ApplicationTemplate loadApplicationTemplate( File applicationFilesDirectory ); @Override void deleteApplicationTemplate( String tplName, String tplVersion ); @Override void restoreTemplates();  }
@Test @SuppressWarnings( "unchecked" ) public void testFindTemplate() throws Exception { Map<ApplicationTemplate,Boolean> map = TestUtils.getInternalField( this.mngr, "templates", Map.class ); Assert.assertNull( this.mngr.findTemplate( "lamp", null )); ApplicationTemplate tpl = new ApplicationTemplate( "lamp" ); map.put( tpl, Boolean.TRUE ); Assert.assertEquals( tpl, this.mngr.findTemplate( "lamp", null )); ApplicationTemplate tpl2 = new ApplicationTemplate( "lamp" ).version( "v2" ); map.put( tpl2, Boolean.TRUE ); Assert.assertFalse( tpl.equals( tpl2 )); Assert.assertEquals( tpl2, this.mngr.findTemplate( "lamp", "v2" )); Assert.assertEquals( tpl, this.mngr.findTemplate( "lamp", null )); Assert.assertNull( this.mngr.findTemplate( "lamp", "v3" )); Assert.assertNull( this.mngr.findTemplate( "lamp2", null )); }