HudsonVersionExtractor { public String version() { String right = content.split("Hudson ver\\.")[1].trim(); String version = right.split("<")[0]; return version; } HudsonVersionExtractor(String content); String version();  }
@Test public void should_extract_version_in_jenkins_page() throws IOException { Class<? extends HudsonVersionExtractorTest> clazz = this.getClass(); ClassLoader classLoader = clazz.getClassLoader(); InputStream stream = classLoader.getResourceAsStream("hudson_version_page.html"); byte[] data = ByteStreams.toByteArray(stream); HudsonVersionExtractor hve = new HudsonVersionExtractor(new String(data)); String version = hve.version(); assertEquals("1.396", version); }