@Test public void should_fail() throws IOException { when(connection.downloadString("/batch/index")).thenThrow(new IOException("io error")); exception.expect(IllegalStateException.class); exception.expectMessage("Fail to get bootstrap index from server"); bootstrapIndexDownloader.getIndex(); }
Collection<JarEntry> getIndex() { String index; try { logger.debug("Get bootstrap index..."); index = conn.downloadString("/batch/index"); logger.debug("Get bootstrap completed"); } catch (Exception e) { throw new IllegalStateException("Fail to get bootstrap index from server", e); } return parse(index); }
BootstrapIndexDownloader { Collection<JarEntry> getIndex() { String index; try { logger.debug("Get bootstrap index..."); index = conn.downloadString("/batch/index"); logger.debug("Get bootstrap completed"); } catch (Exception e) { throw new IllegalStateException("Fail to get bootstrap index from server", e); } return parse(index); } }
BootstrapIndexDownloader { Collection<JarEntry> getIndex() { String index; try { logger.debug("Get bootstrap index..."); index = conn.downloadString("/batch/index"); logger.debug("Get bootstrap completed"); } catch (Exception e) { throw new IllegalStateException("Fail to get bootstrap index from server", e); } return parse(index); } BootstrapIndexDownloader(ServerConnection conn, Logger logger); }
BootstrapIndexDownloader { Collection<JarEntry> getIndex() { String index; try { logger.debug("Get bootstrap index..."); index = conn.downloadString("/batch/index"); logger.debug("Get bootstrap completed"); } catch (Exception e) { throw new IllegalStateException("Fail to get bootstrap index from server", e); } return parse(index); } BootstrapIndexDownloader(ServerConnection conn, Logger logger);  }
BootstrapIndexDownloader { Collection<JarEntry> getIndex() { String index; try { logger.debug("Get bootstrap index..."); index = conn.downloadString("/batch/index"); logger.debug("Get bootstrap completed"); } catch (Exception e) { throw new IllegalStateException("Fail to get bootstrap index from server", e); } return parse(index); } BootstrapIndexDownloader(ServerConnection conn, Logger logger);   }