@Test
void testAuthFailedWhenNoAccessKeyPair() {

    URL url = URL.valueOf("dubbo://10.10.10.10:2181")
            .addParameter(CommonConstants.APPLICATION_KEY, "test-provider")
            .addParameter(Constants.SERVICE_AUTH, true);
    Invoker invoker = mock(Invoker.class);
    Invocation invocation = mock(Invocation.class);
    when(invocation.getObjectAttachment(Constants.REQUEST_SIGNATURE_KEY)).thenReturn("dubbo");
    when(invocation.getObjectAttachment(Constants.AK_KEY)).thenReturn("ak");
    when(invocation.getObjectAttachment(CommonConstants.CONSUMER)).thenReturn("test-consumer");
    when(invocation.getObjectAttachment(Constants.REQUEST_TIMESTAMP_KEY)).thenReturn(System.currentTimeMillis());
    when(invoker.getUrl()).thenReturn(url);
    ProviderAuthFilter providerAuthFilter = new ProviderAuthFilter();
    Result result = providerAuthFilter.invoke(invoker, invocation);
    assertTrue(result.hasException());
    assertTrue(result.getException() instanceof RpcAuthenticationException);
}