MockFunctionServiceHelper implements FunctionServiceHelper { @Override public Execution onRegion(Region region) { MockExecution mockExecution = new MockExecution(this); mockExecution.setRegion(region); return mockExecution; } MockFunctionServiceHelper();  MockFunctionServiceHelper(Function function); @Override Execution onRegion(Region region); @Override Execution onServer(Pool pool); @Override Execution onServers(Pool pool); @Override Execution onServer(RegionService regionService); @Override Execution onServers(RegionService regionService); @Override Execution onMember(DistributedMember distributedMember); @Override Execution onMembers(String... groups); @Override Execution onMembers(Set<DistributedMember> distributedMembers); @Override Execution onMember(String... groups); @Override Function getFunction(String functionId); @Override void registerFunction(Function function); @Override void unregisterFunction(String functionId); @Override boolean isRegistered(String functionId); @Override Map<String, Function> getRegisteredFunctions();  }
@Test public void test() { TestFunction function = new TestFunction(); MockRegion<Object, Object> mockRegion = new MockRegion<>("mock"); MockFunctionServiceHelper helper = new MockFunctionServiceHelper(function); Object result = helper.onRegion(mockRegion).withArgs("args").withFilter(Collections.singleton("filter")).execute(function .getId()).getResult(); assertNotNull(result); assertTrue(result instanceof List); List<Object> list = (List<Object>)result; assertFalse(list.isEmpty()); assertEquals("args", list.get(0)); assertEquals(function.getId(), list.get(1)); assertTrue(list.get(2) == mockRegion); assertTrue(list.get(3) instanceof Set); Set<Object> filter = (Set<Object>) list.get(3); assertNotNull(filter); assertEquals(1,filter.size()); assertEquals("filter",filter.iterator().next()); assertTrue(list.get(4) instanceof Exception); }