Project

General

Profile

Bug #3443

Android unit tests broken

Added by Aaron Brice 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
android
Target version:
Start date:
Due date:
Estimated time:
Affected version:
5.8.4
Resolution:
Fixed

Description

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.

Associated revisions

Revision 84924249 (diff)
Added by Tobias Brunner 5 months ago

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")
Fixes #3443.

History

#1 Updated by Tobias Brunner 5 months ago

  • Status changed from New to Feedback

Thanks for the report. I pushed a fix to the 3443-android-tests-mock branch. Let me know if that works for you.

#2 Updated by Aaron Brice 5 months ago

Yes, works great. "./gradlew build" works on a clean tree now.

#3 Updated by Tobias Brunner 5 months 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.

Also available in: Atom PDF