source: class AttributePrincipalProxyTicketProviderTest {
  
      @Mock
      private AssertionProvider assertionProvider;
      private ProxyTicketProvider proxyTicketProvider;
  
      @Test
      public void getProxyTicket_NullAttributePrincipal_IllegalStateException() {
  
target:         String service = "http://httpbin.org/get";
  
          Assertion assertion = mock(Assertion.class);
          when(assertionProvider.getAssertion()).thenReturn(assertion);
          when(assertion.getPrincipal()).thenReturn(null);
  
          assertThatThrownBy(() -> proxyTicketProvider.getProxyTicket(service))
                  .isInstanceOf(IllegalStateException.class)
                  .hasMessage("Unable to provide a proxy ticket with null %s", AttributePrincipal.class.getSimpleName());
  
          verify(assertionProvider, times(1)).getAssertion();
          verify(assertion, times(1)).getPrincipal();
      }
  
  }