@Test
public void intercept_NullProxyTicket_IllegalStateException() throws IOException {

    String service = "http://httpbin.org/get";
    ClientHttpRequestExecution clientHttpRequestExecution = mock(ClientHttpRequestExecution.class);
    ClientHttpRequest request = new MockClientHttpRequest(HttpMethod.GET, URI.create(service));
    when(proxyTicketProvider.getProxyTicket(service)).thenReturn(null);
    assertThatThrownBy(() -> casAuthorizationInterceptor.intercept(request, null, clientHttpRequestExecution))
            .isInstanceOf(IllegalStateException.class)
            .hasMessage(format("Proxy ticket provider returned a null proxy ticket for service %s.", service));
    verify(proxyTicketProvider, times(1)).getProxyTicket(service);
    verify(clientHttpRequestExecution, never()).execute(request, null);
}