/** * Adds a feature to the profile and tests it on the container. * * <p>Note: Before and after the test the container moves to default profile. * * @param featureName * @param profileName * @param expectedSymbolicName */ public void prepareFeaturesForTesting( Set<Container> containers, String featureName, String profileName, String expectedSymbolicName) { targetContainers.addAll(containers); featureArguments.put( featureName, new String[] {featureName, profileName, expectedSymbolicName}); }
@Test public void testFeatures() throws Exception { String feature = System.getProperty("feature"); if (feature != null && !feature.isEmpty() && featureArguments.containsKey(feature)) { String[] arguments = featureArguments.get(feature); Assert.assertEquals( "Feature " + feature + " should have been prepared with 4 arguments", 3, arguments.length); assertProvisionedFeature(targetContainers, arguments[0], arguments[1], arguments[2]); } else { for (Map.Entry<String, String[]> entry : featureArguments.entrySet()) { feature = entry.getKey(); String[] arguments = entry.getValue(); Assert.assertEquals( "Feature " + feature + " should have been prepared with 4 arguments", 3, arguments.length); assertProvisionedFeature(targetContainers, arguments[0], arguments[1], arguments[2]); } } }