@Test
public void validateAccessTokenScopes() throws Exception {

    HttpURLConnection httpURLConnectionMock = mock(HttpURLConnection.class);
    doNothing().when(httpURLConnectionMock).connect();
    URL urlMock = mock(URL.class);
    whenNew(URL.class).withAnyArguments().thenReturn(urlMock);
    when(urlMock.openConnection(Proxy.NO_PROXY)).thenReturn(httpURLConnectionMock);
    when(httpURLConnectionMock.getHeaderField("X-OAuth-Scopes")).thenReturn("user:email,repo");
    when(httpURLConnectionMock.getResponseCode()).thenReturn(200);
    HttpURLConnection httpURLConnection = GithubScm.connect(GitHubSCMSource.GITHUB_URL, "abcd");
    GithubScm.validateAccessTokenScopes(httpURLConnection);
}