test_class.declarator: tokenFilter = new TokenFilter()
test_class.modifier: private
test_class.original_string: private TokenFilter tokenFilter = new TokenFilter();
test_class.type: TokenFilter
test_class.var_name: tokenFilter
test_class.file: dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/TokenFilterTest.java
test_class.identifier: TokenFilterTest
test_case.body: @Test
      public void testInvokeWithoutToken() throws Exception {
          Assertions.assertThrows(RpcException.class, () -> {
              String token = "token";
  
              Invoker invoker = Mockito.mock(Invoker.class);
              URL url = URL.valueOf("test://test:11/test?accesslog=true&group=dubbo&version=1.1&token=" + token);
              when(invoker.getUrl()).thenReturn(url);
              when(invoker.invoke(any(Invocation.class))).thenReturn(new AppResponse("result"));
  
              Invocation invocation = Mockito.mock(Invocation.class);
  
              tokenFilter.invoke(invoker, invocation);
          });
      }
test_case.class_method_signature: TokenFilterTest.testInvokeWithoutToken()
test_case.full_signature: @Test public void testInvokeWithoutToken()
test_case.identifier: testInvokeWithoutToken
test_case.invocations: assertThrows mock valueOf thenReturn when getUrl thenReturn when invoke any mock invoke
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvokeWithoutToken()
focal_class.file: dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/TokenFilter.java
focal_class.identifier: TokenFilter
focal_class.interfaces: implements Filter
focal_class.class_method_signature: TokenFilter.invoke(Invoker<?> invoker, Invocation inv)
focal_class.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation inv)
focal_class.identifier: invoke
focal_class.modifiers: @Override public
focal_class.parameters: (Invoker<?> invoker, Invocation inv)
focal_class.return: Result
focal_class.signature: Result invoke(Invoker<?> invoker, Invocation inv)
focal_method.body: @Override
      public Result invoke(Invoker<?> invoker, Invocation inv)
              throws RpcException {
          String token = invoker.getUrl().getParameter(TOKEN_KEY);
          if (ConfigUtils.isNotEmpty(token)) {
              Class<?> serviceType = invoker.getInterface();
              Map<String, Object> attachments = inv.getObjectAttachments();
              String remoteToken = (attachments == null ? null : (String) attachments.get(TOKEN_KEY));
              if (!token.equals(remoteToken)) {
                  throw new RpcException("Invalid token! Forbid invoke remote service " + serviceType + " method " + inv.getMethodName() + "() from consumer " + RpcContext.getContext().getRemoteHost() + " to provider " + RpcContext.getContext().getLocalHost());
              }
          }
          return invoker.invoke(inv);
      }
focal_method.class_method_signature: TokenFilter.invoke(Invoker<?> invoker, Invocation inv)
focal_method.full_signature: @Override public Result invoke(Invoker<?> invoker, Invocation inv)
focal_method.identifier: invoke
focal_method.invocations: getParameter getUrl isNotEmpty getInterface getObjectAttachments get equals getMethodName getRemoteHost getContext getLocalHost getContext invoke
focal_method.modifiers: @Override public
focal_method.parameters: (Invoker<?> invoker, Invocation inv)
focal_method.return: Result
focal_method.signature: Result invoke(Invoker<?> invoker, Invocation inv)