@Test public void set_propertyBasedConfiguration() { PropertyBasedConfiguration configuration = new PropertyBasedConfiguration(); configuration.getProperties().add(new Property("a", "1")); configuration.getProperties().add(new Property("b", "2")); PropertyBasedRequirement requirement = new PropertyBasedRequirement(); setter.set(requirement, configuration); assertThat(requirement.getA(), is("1")); assertThat(requirement.getB(), is("2")); }
@SuppressWarnings({"rawtypes", "unchecked"}) private XMLReader createReader(Class<?>... classes) { List<PropertyBasedConfiguration> configs = new ArrayList<PropertyBasedConfiguration>(); for (Class clazz : classes) { PropertyBasedConfiguration config = mock(PropertyBasedConfiguration.class); when(config.getRequirementClassName()).thenReturn(clazz.getCanonicalName()); configs.add(config); } XMLReader reader = mock(XMLReader.class); when(reader.getConfiguration(any(Class.class))).thenReturn(configs); return reader; }