Slide 49
Slide 49 text
public class ToolLocationTest {
@Rule
public JenkinsRule j = new JenkinsRule();
@Test
public void toolCompatibility() {
Maven.MavenInstallation[] maven = j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations();
assertEquals(1, maven.length);
assertEquals("bar", maven[0].getHome());
assertEquals("Maven 1", maven[0].getName());
Ant.AntInstallation[] ant = j.jenkins.getDescriptorByType(Ant.DescriptorImpl.class).getInstallations();
assertEquals(1, ant.length);
assertEquals("foo", ant[0].getHome());
assertEquals("Ant 1", ant[0].getName());
JDK[] jdk = j.jenkins.getDescriptorByType(JDK.DescriptorImpl.class).getInstallations();
assertEquals(Arrays.asList(jdk), j.jenkins.getJDKs());
assertEquals(2, jdk.length); // JenkinsRule adds a 'default' JDK
assertEquals("default", jdk[1].getName()); // make sure it's really that we're seeing
assertEquals("FOOBAR", jdk[0].getHome());
Java - Jenkins