You are viewing an old version of this page. View the current version.
Compare with Current View Page History
Version 1 Current »
URLConnection mockURLConnection = mock(HttpsURLConnection.class); URL mockUrl = mock(URL.class); when(new URL(anyString())).thenReturn(mockUrl); when(mockUrl.openConnection()).thenReturn(mockURLConnection);