Apparently in Java an URL is equal if the ip is the same, so the following test will succeed (kapaza.be and kapaza.nl have the same ip address).
public void testURLEquals() throws MalformedURLException {
assertEquals(new URL("http://www.kapaza.be"), new URL("http://www.kapaza.nl"));
}
Just so you know when you get strange results when putting URLs in a Set… It’s even worse, since this means that comparing URLs needs name resolution, which is a slowdown. More in the Javadocs.
One solution is to use an URI instead of an URL. This will fail:
public void testURIEquals() throws URISyntaxException {
assertEquals(new URI("http://www.kapaza.be"), new URI("http://www.kapaza.nl"));
}