提问人:dgmltn 提问时间:4/13/2016 最后编辑:CinCoutdgmltn 更新时间:12/18/2021 访问量:701
Android Patterns.WEB_URL坏了?
Android Patterns.WEB_URL broken?
问:
那么,有人可以解释一下在我的测试中尾部斜杠发生了什么吗?还是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 "/"
}
}
答: 暂无答案
评论
https://google.com/foo/