JenkinsVersionExtractor { String version() { String right = content.split("Jenkins ver\\.")[1].trim(); String version = right.split("<")[0]; return version; } JenkinsVersionExtractor(String content);   }
@Test public void should_extract_version() { String content = "6 juin 2011 21:50:35</span><a href=\"http: JenkinsVersionExtractor jve = new JenkinsVersionExtractor(content); String version = jve.version(); assertEquals("1.407", version); }
@Test public void should_extract_version_in_jenkins_page() throws IOException { Class<? extends JenkinsVersionExtractorTest> clazz = this.getClass(); ClassLoader classLoader = clazz.getClassLoader(); InputStream stream = classLoader.getResourceAsStream("jenkins_version_page.html"); byte[] data = ByteStreams.toByteArray(stream); JenkinsVersionExtractor jve = new JenkinsVersionExtractor(new String(data)); String version = jve.version(); assertEquals("1.407", version); }