@Test(expected = BambooVersionNotFoundException.class) public void should_throw_exception_if_version_is_not_found() throws BambooVersionNotFoundException { BambooVersionExtractor.extractVersion(""); }
static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } private  BambooVersionExtractor(); }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } private  BambooVersionExtractor();  }
BambooVersionExtractor { static String extractVersion(URL url) throws BambooVersionNotFoundException { InputStream stream = null; try { stream = url.openStream(); byte[] bytes = ByteStreams.toByteArray(stream); String page = new String(bytes); return extractVersion(page); } catch (IOException e) { throw new BambooVersionNotFoundException("Can't extract version from url:" + url, e); } finally { Closeables.closeQuietly(stream); } } private  BambooVersionExtractor();   }