@Test public void testInteropolateDependencies() throws Exception { final Model model = TestUtils.resolveModelResource(RESOURCE_BASE, "infinispan-bom-8.2.0.Final.pom"); Project project = new Project(model); PropertyInterpolator pi = new PropertyInterpolator(project.getModel().getProperties(), project); String nonInterp = "", interp = ""; for (Dependency d : project.getManagedDependencies()) { nonInterp += (d.getGroupId().equals("${project.groupId}") ? project.getGroupId() : d.getGroupId()) + ":" + (d.getArtifactId().equals("${project.artifactId}") ? project.getArtifactId() : d.getArtifactId()) + System.lineSeparator(); interp += pi.interp( d.getGroupId().equals("${project.groupId}") ? project.getGroupId() : d.getGroupId()) + ":" + pi.interp( d.getArtifactId().equals("${project.artifactId}") ? project.getArtifactId() : d.getArtifactId()) + System.lineSeparator(); } assertTrue(nonInterp.contains("${")); assertFalse(interp.contains("${")); }
@Test public void testInteropolateProperties() throws Exception { final Model model = TestUtils.resolveModelResource(RESOURCE_BASE, "infinispan-bom-8.2.0.Final.pom"); Project p = new Project(model); Properties props = p.getModel().getProperties(); boolean containsProperty = false; for (Object o : props.values()) { if (((String) o).contains("${")) { containsProperty = true; } } assertTrue(containsProperty); PropertyInterpolator pi = new PropertyInterpolator(props, p); assertTrue(pi.interp("${version.hibernate.osgi}").equals("5.0.4.Final")); }