Skip to content

Conversation

@kohlschuetter
Copy link
Contributor

Some unit tests work with fake ("mocked") InetAddress objects, which are currently assembled via mockito. With Java 21 and newer, this is no longer possible.

Replace the mocking code with a new "InetAddressMockery" class that can provide real Inet4Address objects by means of Java object deserialization.

Fixes #144

Copy link
Member

@kofemann kofemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking at this. The proposed solution seems overengineered. Please consider an alternative approach.

Some unit tests work with fake ("mocked") InetAddress objects, which are
currently assembled via mockito. With Java 21 and newer, this is no
longer possible.

Replace the mocking code with direct calls to
InetAddress.getByAddress(String,byte[]).

Fixes dCache#144

Signed-off-by: Christian Kohlschütter <[email protected]>
@kohlschuetter kohlschuetter changed the title test: Fix tests on Java 21 or newer; add new InetAddress mocking code test: Fix tests on Java 21 or newer; replace InetAddress mocking code Jun 17, 2025
@kofemann
Copy link
Member

Thanks for the contribution 🚀

@kofemann kofemann merged commit e2c2f03 into dCache:master Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InetAddress mocking breaks java21 builds

2 participants