Android unit tests broken
Commit 2ef473be15320a6bed23702f1481ba6b2020eb4a updated utils/IPRange.java to use a libandroidbridge.so helper function parseInetAddressBytes instead of java methods. This breaks some junit tests in IPRangeTest.java and IPRangeSetTest.java because the unit tests don't load the NDK libraries. This in turn causes a "./gradlew build" to fail.
android: Mock parseInetAddress() method to fix unit tests
The native parseInetAddressBytes() method called by that method is not
available when running the tests.
Not very pretty and there are some warnings because PowerMock does
reflection in some illegal way but it fixes the unit tests and does
not require any new dependencies like Apache Commons or Guava just to
parse IP addresses without DNS lookup.
Fixes: 2ef473be1532 ("android: Use helper to parse IP addresses where appropriate")
#3 Updated by Tobias Brunner over 1 year ago
- Tracker changed from Issue to Bug
- Status changed from Feedback to Closed
- Assignee set to Tobias Brunner
- Target version set to 5.9.0
- Resolution set to Fixed
Yes, works great. "./gradlew build" works on a clean tree now.
Great, thanks for testing. I'll include the fixes when I merge the changes for #3364.