BuildPropertiesParserImpl implements BuildPropertiesParser, Disposable { protected void interpolate(Properties properties, File baseDir) { if (properties.isEmpty()) { return; } MavenSession mavenSession = legacySupport.getSession(); if (mavenSession == null) { logger.warn("No maven session available, values in the build.properties will not be interpolated!"); return; } MavenProject mavenProject = MavenSessionUtils.getMavenProject(mavenSession, baseDir); if (mavenProject == null) { logger.warn("No maven project found for baseDir '" + baseDir.getAbsolutePath() + "', values in the build.properties will not be interpolated!"); return; } TychoInterpolator interpolator = new TychoInterpolator(mavenSession, mavenProject); for (Entry<Object, Object> entry : properties.entrySet()) { entry.setValue(interpolator.interpolate((String) entry.getValue())); } } BuildPropertiesParserImpl(); protected  BuildPropertiesParserImpl(LegacySupport legacySupport, Logger logger); @Override BuildProperties parse(File baseDir); @Override void dispose();  }
@Test public void testInterpolateWithABaseDirThatsNotPartOfTheSessionsProjects() { Properties props = new Properties(); props.put("key", "value"); parser.interpolate(props, new File("/bathToSomeProjectThatsNotPartOfTheSessionProjects")); verify(logger, times(1)).warn(anyString()); }
@Test public void testInterpolateWithEmptyProperties() { parser.interpolate(new Properties(), null); }