MockInvoker implements Invoker<T> { public static Object parseMockValue(String mock) throws Exception { return parseMockValue(mock, null); } MockInvoker(URL url, Class<T> type); static Object parseMockValue(String mock); static Object parseMockValue(String mock, Type[] returnTypes); @Override Result invoke(Invocation invocation); static Throwable getThrowable(String throwstr); @SuppressWarnings("unchecked") static Object getMockObject(String mockService, Class serviceType); static String normalizeMock(String mock); @Override URL getUrl(); @Override boolean isAvailable(); @Override void destroy(); @Override Class<T> getInterface();  }
@Test public void testParseMockValue() throws Exception { Assertions.assertNull(MockInvoker.parseMockValue("null")); Assertions.assertNull(MockInvoker.parseMockValue("empty")); Assertions.assertTrue((Boolean) MockInvoker.parseMockValue("true")); Assertions.assertFalse((Boolean) MockInvoker.parseMockValue("false")); Assertions.assertEquals(123, MockInvoker.parseMockValue("123")); Assertions.assertEquals("foo", MockInvoker.parseMockValue("foo")); Assertions.assertEquals("foo", MockInvoker.parseMockValue("\"foo\"")); Assertions.assertEquals("foo", MockInvoker.parseMockValue("\'foo\'")); Assertions.assertEquals( new HashMap<>(), MockInvoker.parseMockValue("{}")); Assertions.assertEquals( new ArrayList<>(), MockInvoker.parseMockValue("[]")); Assertions.assertEquals("foo", MockInvoker.parseMockValue("foo", new Type[]{String.class})); }