@Test
public void closeOpenedConnection() throws IOException {

  InputStream is = PowerMock.createMock(InputStream.class);
  is.close();
  URLConnection uc = PowerMock.createMock(URLConnection.class);
  expect(uc.getLastModified()).andReturn(123L);
  expect(uc.getInputStream()).andReturn(is);
  URL url = PowerMock.createMock(URL.class);
  expect(url.openConnection()).andReturn(uc);
  String filename = "home.hbs";
  Object[] mocks = {url, uc, is};
  PowerMock.replay(mocks);
  assertEquals(123L, new URLTemplateSource(filename, url).lastModified());
  PowerMock.verify(mocks);
}