### Question:
ReconUtils { public HttpURLConnection makeHttpCall(URLConnectionFactory connectionFactory, String url, boolean isSpnego) throws IOException, AuthenticationException { HttpURLConnection urlConnection = (HttpURLConnection) connectionFactory.openConnection(new URL(url), isSpnego); urlConnection.connect(); return urlConnection; } ReconUtils(); static File getReconScmDbDir(ConfigurationSource conf); File getReconDbDir(ConfigurationSource conf, String dirConfigKey); static File createTarFile(Path sourcePath); void untarCheckpointFile(File tarFile, Path destPath); HttpURLConnection makeHttpCall(URLConnectionFactory connectionFactory,
                                  String url, boolean isSpnego); File getLastKnownDB(File reconDbDir, String fileNamePrefix); static void upsertGlobalStatsTable(Configuration sqlConfiguration,
                                            GlobalStatsDao globalStatsDao,
                                            String key,
                                            Long count);  }### Answer:
@Test public void testMakeHttpCall() throws Exception { String url = "http: File file1 = Paths.get(folder.getRoot().getPath(), "file1") .toFile(); BufferedWriter writer = new BufferedWriter(new FileWriter( file1.getAbsolutePath())); writer.write("File 1 Contents"); writer.close(); InputStream fileInputStream = new FileInputStream(file1); String contents; URLConnectionFactory connectionFactoryMock = mock(URLConnectionFactory.class); HttpURLConnection urlConnectionMock = mock(HttpURLConnection.class); when(urlConnectionMock.getInputStream()).thenReturn(fileInputStream); when(connectionFactoryMock.openConnection(any(URL.class), anyBoolean())) .thenReturn(urlConnectionMock); try (InputStream inputStream = new ReconUtils() .makeHttpCall(connectionFactoryMock, url, false).getInputStream()) { contents = IOUtils.toString(inputStream, Charset.defaultCharset()); } assertEquals("File 1 Contents", contents); }