### Question:
SentinelSofaRpcProviderFilter extends AbstractSofaRpcFilter { @Override public SofaResponse invoke(FilterInvoker invoker, SofaRequest request) throws SofaRpcException { if (request.getInvokeType() != null && !RpcConstants.INVOKER_TYPE_SYNC.equals(request.getInvokeType())) { return invoker.invoke(request); } String callerApp = getApplicationName(request); String interfaceResourceName = getInterfaceResourceName(request); String methodResourceName = getMethodResourceName(request); Entry interfaceEntry = null; Entry methodEntry = null; try { ContextUtil.enter(methodResourceName, callerApp); interfaceEntry = SphU.entry(interfaceResourceName, ResourceTypeConstants.COMMON_RPC, EntryType.IN); methodEntry = SphU.entry(methodResourceName, ResourceTypeConstants.COMMON_RPC, EntryType.IN, getMethodArguments(request)); SofaResponse response = invoker.invoke(request); traceResponseException(response, interfaceEntry, methodEntry); return response; } catch (BlockException e) { return SofaRpcFallbackRegistry.getProviderFallback().handle(invoker, request, e); } catch (Throwable t) { throw traceOtherException(t, interfaceEntry, methodEntry); } finally { if (methodEntry != null) { methodEntry.exit(1, getMethodArguments(request)); } if (interfaceEntry != null) { interfaceEntry.exit(); } ContextUtil.exit(); } }  @Override SofaResponse invoke(FilterInvoker invoker, SofaRequest request);  }### Answer:
@Test public void testInvokeSentinelWorks() { SentinelSofaRpcProviderFilter filter = new SentinelSofaRpcProviderFilter(); final String applicationName = "demo-provider"; final String interfaceResourceName = "com.alibaba.csp.sentinel.adapter.sofa.rpc.service.DemoService"; final String methodResourceName = "com.alibaba.csp.sentinel.adapter.sofa.rpc.service.DemoService#sayHello(java.lang.String,int)"; SofaRequest request = mock(SofaRequest.class); when(request.getRequestProp("app")).thenReturn(applicationName); when(request.getInvokeType()).thenReturn(RpcConstants.INVOKER_TYPE_SYNC); when(request.getInterfaceName()).thenReturn(interfaceResourceName); when(request.getMethodName()).thenReturn("sayHello"); when(request.getMethodArgSigs()).thenReturn(new String[]{"java.lang.String", "int"}); when(request.getMethodArgs()).thenReturn(new Object[]{"Sentinel", 2020}); FilterInvoker filterInvoker = mock(FilterInvoker.class); when(filterInvoker.invoke(request)).thenAnswer(new Answer<SofaResponse>() { @Override public SofaResponse answer(InvocationOnMock invocationOnMock) throws Throwable { verifyInvocationStructure(applicationName, interfaceResourceName, methodResourceName); SofaResponse response = new SofaResponse(); response.setAppResponse("Hello Sentinel 2020"); return response; } }); assertNull(ContextUtil.getContext()); SofaResponse response = filter.invoke(filterInvoker, request); assertEquals("Hello Sentinel 2020", response.getAppResponse()); verify(filterInvoker).invoke(request); assertNull(ContextUtil.getContext()); }