Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Do not mock sealed classes with java 21
  • Loading branch information
amarziali committed Jun 4, 2025
commit fef3bcd449dfe4c54dedb3d439ab67ae40a92c82
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,18 @@ class HostNameResolverForkedTest extends DDSpecification {
}

def "should use the cache for unresolved addresses"() {
setup:
def inet1 = Mock(InetAddress)
def inet2 = Mock(InetAddress)
given:
def inet1 = new Inet4Address(null, InetAddress.getLocalHost().getAddress())
def inet2 = new Inet4Address(null, 0) // this will fail if a resolution will happen
when:
def address = new InetSocketAddress(inet1, 666)
def host = HostNameResolver.hostName(address.getAddress(), "127.0.0.1")
then:
host == "somehost"
1 * inet1.getHostName() >> "somehost"
host != null
when:
address = new InetSocketAddress(inet2, 666)
host = HostNameResolver.hostName(address.getAddress(), "127.0.0.1")
def host2 = HostNameResolver.hostName(address.getAddress(), "127.0.0.1")
then:
0 * inet2.getHostName()
host == "somehost"
host == host2
}
}