### Question:
DubboEnhancer extends BeforeEnhancer { public String[] getServiceNameWithVersionGroup(Object invocation, Object url) throws Exception { String serviceKey = ReflectUtil.invokeMethod(url, GET_SERVICE_KEY, new Object[0], false); if (serviceKey == null) { LOGGER.warn("Service key is null in dubbo consumer. invocation: {}", invocation); return null; } else { int groupSep = serviceKey.indexOf(GROUP_SEP); String group = null; if (INVALID_POS != groupSep) { group = serviceKey.substring(0, groupSep); serviceKey = serviceKey.substring(groupSep + 1); } String[] serviceAndVersion = serviceKey.split(SPLIT_TOKEN); if (serviceAndVersion.length == 1) { return new String[] {serviceAndVersion[0], DEFAULT_VERSION, group}; } return new String[] {serviceAndVersion[0], serviceAndVersion[1], group}; } }  @Override EnhancerModel doBeforeAdvice(ClassLoader classLoader, String className, Object object,
                                        Method method, Object[]
                                            methodArguments); String[] getServiceNameWithVersionGroup(Object invocation, Object url); static final String DEFAULT_VERSION; static final String GET_URL; static final String GET_PARAMETER; static final String APPLICATION_KEY; static final String GET_SERVICE_KEY; static final String GET_METHOD_NAME; static final String GET_ARGUMENTS; static final String GENERIC; static final String SPLIT_TOKEN; static final String GROUP_SEP; static final String GET_INVOKER; static final String RECEIVED_METHOD; static final int INVALID_POS; }### Answer:
@Test public void testGetServiceNameWithVersionGroup_ServiceSplit() throws Exception { DubboConsumerEnhancer consumerEnhancer = new DubboConsumerEnhancer(); MockDubboUrl mockDubboUrl = new MockDubboUrl(); mockDubboUrl.setServiceKey("daily/com.alibaba.dubbo.demo.DemoService"); String[] serviceVersion = consumerEnhancer.getServiceNameWithVersionGroup(new Object(), mockDubboUrl); Assert.assertTrue(3==serviceVersion.length); Assert.assertEquals("daily", serviceVersion[2]); mockDubboUrl.setServiceKey("com.alibaba.dubbo.demo.DemoService:2.0.0"); serviceVersion = consumerEnhancer.getServiceNameWithVersionGroup(new Object(), mockDubboUrl); Assert.assertTrue(3==serviceVersion.length); Assert.assertEquals("com.alibaba.dubbo.demo.DemoService", serviceVersion[0]); Assert.assertEquals("2.0.0", serviceVersion[1]); Assert.assertNull(serviceVersion[2]); }