/* * Assert that a feature with the given id exists in the configuration. If * a version is specified then match the version, otherwise any version will * do. */ public void assertFeatureExists( String message, Configuration configuration, String id, String version) { List sites = configuration.getSites(); assertNotNull(message, sites); boolean found = false; for (Iterator iter = sites.iterator(); iter.hasNext(); ) { Site site = (Site) iter.next(); Feature[] features = site.getFeatures(); for (int i = 0; features != null && i < features.length; i++) { if (id.equals(features[i].getId())) { if (version == null) found = true; else if (version.equals(features[i].getVersion())) found = true; } } } assertTrue(message, found); }