TychoInterpolator implements Interpolator { @Override public String interpolate(String input) { try { return interpolator.interpolate(input); } catch (org.codehaus.plexus.interpolation.InterpolationException e) { throw new RuntimeException("Error while interpolating value \"" + input + "\"", e); } } TychoInterpolator(MavenSession mavenSession, MavenProject mavenProject); @Override String interpolate(String input);  }
@Test public void testProjectPropertiesGetInterpolated() { String interpolated = interpolator.interpolate("${myProjectPropertyKey}"); Assert.assertEquals("myProjectPropertyValue", interpolated); }
@Test public void testUserPropertiesGetInterpolated() { String interpolated = interpolator.interpolate("${myUserPropertyKey}"); Assert.assertEquals("myUserPropertyValue", interpolated); }
@Test public void testSystemPropertiesGetInterpolated() { String interpolated = interpolator.interpolate("${mySystemPropertyKey}"); Assert.assertEquals("mySystemPropertyValue", interpolated); }
@Test public void testLocalRepositoryGetInterpolated() { String interpolated = interpolator.interpolate("${localRepository}"); Assert.assertEquals("myLocalRepo", interpolated); }
@Test public void testBaseDirGetInterpolated() { String interpolated = interpolator.interpolate("${basedir}"); Assert.assertEquals("absolutePathToBaseDir", interpolated); }
@Test public void testVersionGetInterpolated() { String interpolated = interpolator.interpolate("${version}"); Assert.assertEquals("1.0.0", interpolated); }
@Test public void testProjectMembersGetInterpolated() { when(project.getArtifactId()).thenReturn("myArtifactId"); String interpolated = interpolator.interpolate("${project.artifactId}"); Assert.assertEquals("myArtifactId", interpolated); }
@Test public void testSettingsMembersGetInterpolated() { when(settings.getSourceLevel()).thenReturn("mySourceLevel"); String interpolated = interpolator.interpolate("${settings.sourceLevel}"); Assert.assertEquals("mySourceLevel", interpolated); }
@Test public void testInterpolateSubString() { assertThat(interpolator.interpolate("pre1${localRepository}1post"), is("pre1myLocalRepo1post")); }
@Test public void testInterpolateNonExisting() { assertThat(interpolator.interpolate("${undefined}"), is("${undefined}")); }
@Test public void testInterpolateSyntaxError() { assertThat(interpolator.interpolate("${not closed"), is("${not closed")); }