private void expectProperty(String propertyName, String propertyValue) { try { ConfigurationProperty configurationProperty = mock(ConfigurationProperty.class, propertyName + "config-property"); when(mockPropertyOracle().getConfigurationProperty(propertyName)) .thenReturn(configurationProperty); when(configurationProperty.getValues()).thenReturn(Arrays.asList(propertyValue)); } catch (BadPropertyValueException e) { } }
public void testWritesTargetLibraryProperties() throws UnableToCompleteException { compilerContext = compilerContextBuilder.compileMonolithic(false).build(); ModuleDef libraryOneModule = ModuleDefLoader.loadFromClassPath( TreeLogger.NULL, compilerContext, "com.google.gwt.dev.cfg.testdata.separate.libraryone.LibraryOne", false); // Library one sees all defined values for the "libraryTwoProperty" binding property and knows // which one was defined in this target library. for (BindingProperty bindingProperty : libraryOneModule.getProperties().getBindingProperties()) { if (!bindingProperty.getName().equals("libraryTwoProperty")) { continue; } assertEquals( Sets.newHashSet(bindingProperty.getDefinedValues()), Sets.newHashSet("yes", "no", "maybe")); assertEquals( Sets.newHashSet(bindingProperty.getTargetLibraryDefinedValues()), Sets.newHashSet("maybe")); } // Library one added a new defined value of "maybe" for the "libraryTwoProperty" binding // property. assertEquals( Sets.newHashSet( mockLibraryWriter.getNewBindingPropertyValuesByName().get("libraryTwoProperty")), Sets.newHashSet("maybe")); // Library one sees all defined values for the "libraryTwoConfigProperty" property and knows // which one was defined in this target library. for (ConfigurationProperty configurationProperty : libraryOneModule.getProperties().getConfigurationProperties()) { if (!configurationProperty.getName().equals("libraryTwoConfigProperty")) { continue; } assertEquals(Sets.newHashSet(configurationProperty.getValues()), Sets.newHashSet("false")); assertEquals( Sets.newHashSet(configurationProperty.getTargetLibraryValues()), Sets.newHashSet("false")); } // Library one added a new defined value of "maybe" for the "libraryTwoConfigProperty" // property. assertEquals( Sets.newHashSet( mockLibraryWriter .getNewConfigurationPropertyValuesByName() .get("libraryTwoConfigProperty")), Sets.newHashSet("false")); }