### Question:
EurekaUtils { public static final String getServiceIdFromInstanceId(String instanceId) { final int startIndex = instanceId.indexOf(':'); if (startIndex < 0) return null; final int endIndex = instanceId.indexOf(':', startIndex + 1); if (endIndex < 0) return null; return instanceId.substring(startIndex + 1, endIndex); } private  EurekaUtils(); static final String getServiceIdFromInstanceId(String instanceId); static final String getUrl(InstanceInfo instanceInfo);  }### Answer:
@Test public void test() { assertEquals("abc", EurekaUtils.getServiceIdFromInstanceId("123:abc:def:::::xyz")); assertEquals("abc", EurekaUtils.getServiceIdFromInstanceId("123:abc:def")); assertEquals("", EurekaUtils.getServiceIdFromInstanceId("123::def")); assertEquals("", EurekaUtils.getServiceIdFromInstanceId("::")); assertNull(EurekaUtils.getServiceIdFromInstanceId(":")); assertNull(EurekaUtils.getServiceIdFromInstanceId("")); assertNull(EurekaUtils.getServiceIdFromInstanceId("abc")); }