TracerUtils { public static String removeJSessionIdFromUrl(String url) { if (url == null) { return null; } int index = url.indexOf(";jsessionid="); if (index < 0) { return url; } return url.substring(0, index); }  static String getTraceId(); static boolean checkBaggageLength(SofaTracerSpan sofaTracerSpan, String key, String value); static int getSysBaggageMaxLength(); static int getBaggageMaxLength(); static String getPID(); static LogReserveConfig parseLogReserveConfig(String logReserveConfig); static boolean isLoadTest(SofaTracerSpan sofaTracerSpan); static String getLoadTestMark(SofaTracerSpan span); static String getInetAddress(); static String removeJSessionIdFromUrl(String url); static String getCurrentZone(); static String getDefaultTimeZone(); static String getEmptyStringIfNull(Map<String, String> map, String key); static String hostToHexString(String host); static final String KEY_OF_CURRENT_ZONE; static final String CURRENT_ZONE; static String P_ID_CACHE; }
@Test public void JSessionId_URL_NO_JSessionId() { String url = "http: Assert.assertEquals(url, TracerUtils.removeJSessionIdFromUrl(url)); }
@Test public void JSessionId_URL包含JSessionId() { String url = "http: String jsessionId = ";jsessionid=1A530637289A03B07199A44E8D531427"; Assert.assertEquals(url, TracerUtils.removeJSessionIdFromUrl(url + jsessionId)); }
@Test public void JSessionId_URL_is_null() { Assert.assertNull(TracerUtils.removeJSessionIdFromUrl(null)); }
@Test public void JSessionId_URL_EMPTY() { Assert.assertEquals(StringUtils.EMPTY_STRING, TracerUtils.removeJSessionIdFromUrl(StringUtils.EMPTY_STRING)); }