ImportHelpers { public static Import findImportByExportingInstance( Collection<Import> imports, String exportingInstancePath ) { Import result = null; if( imports != null && exportingInstancePath != null ) { for( Import imp : imports ) { if( exportingInstancePath.equals( imp.getInstancePath())) { result = imp; break; } } } return result; } private  ImportHelpers(); static boolean hasAllRequiredImports( Instance instance, Logger logger ); static Import buildTailoredImport(
			Instance instanceThatUseTheImport,
			String exportingInstancePath,
			String exportingInstanceComponent,
			Map<String,String> exportedVariables ); static void addImport( Instance instance, String componentOrFacetName, Import imp ); static void updateImports( Instance instance, Map<String,Collection<Import>> variablePrefixToImports ); static Import findImportByExportingInstance( Collection<Import> imports, String exportingInstancePath );  }
@Test public void testFindImportByExportingInstance() { Collection<Import> imports = new HashSet<Import> (); imports.add( new Import( "/some/path", "comp1" )); imports.add( new Import( "/some/path/deeper", "comp1" )); imports.add( new Import( "/some/other-path", "comp1" )); Assert.assertNull( ImportHelpers.findImportByExportingInstance( null, null )); Assert.assertNull( ImportHelpers.findImportByExportingInstance( null, "/some/path" )); Assert.assertNull( ImportHelpers.findImportByExportingInstance( imports, null )); Assert.assertNull( ImportHelpers.findImportByExportingInstance( imports, "/wrong/path" )); Assert.assertEquals( "/some/path", ImportHelpers.findImportByExportingInstance( imports, "/some/path" ).getInstancePath()); Assert.assertEquals( "/some/path/deeper", ImportHelpers.findImportByExportingInstance( imports, "/some/path/deeper" ).getInstancePath()); }