Hi I have a method that takes an URL as an input and determines if it is reachable. Heres the code for that:
public static boolean isUrlAccessible(final Str
You can mock new Url instance with
whenNew(URL.class)..
Make sure you return a previously created mock object from that whenNew call.
URL mockUrl = Mockito.mock(URL.class); whenNew(URL.class).....thenReturn(mockUrl );
Then you can add behavior to your mock as you want.