Don't understand feedback from buildbot

What is this supposed to mean?

expected: java.lang.String<abc> but was: prog2.uri.ref.HostRef<abc>

You likely did something like assertEquals("abc", uri.getHost(), didn’t you?

The problem is that getHost() is not a String. So it will not be equals to a String, i.e. String#equals will always return false.

The message tells you that you compared a String to a HostRef. HostRef is the internal class the reference uses to implement the Host interface.

What you likely want to do is compare "abc" to uri.getHost().toString() instead, which actually has the proper type (and also makes a lot more sense semantically).


Thank you, that makes sense. That would also mean that I have to add toString() to other assertions for path, query and userinfo right? And in the sample test, why is toString() not used to compare the scheme?

No, since the other methods already return a String. The problem is that for the host, we want to be able to see whether the host was an IP address, so we have a new interface Host which is extended by another interface IPv4Address. Thus, we can not return String there.