I have a legacy code where the code looks like below :
public String getToken() {
HttpURLConnection urlConnection = (HttpURLConnection)(new URL(endpoint).getConnection();
..
}
How to mock a new URL(endpoint).getConnection()
. Until I get a mocked urlConnection
, I can't proceed into further statements of the method.