那么,有人可以在我的测试中解释尾部斜线发生了什么变化吗?或者它是WEB_URL模式的错误?
@Test
public void testWebUrl() {
String url = "http://www.google.com/foo/";
String test = "A string that fails is this: " + url + " <-- see that?";
Matcher m = Patterns.WEB_URL.matcher(test);
while (m.find()) {
assertTrue(Patterns.WEB_URL.matcher(url).matches()); // PASSES
assertEquals(m.group(), url); // FAILS
// Here, m.group() == "http://www.google.com/foo", without the trailing "/"
}
}