How do I test an android library from an application?

In the following situation:

Foo > Bar-v1 Baz :: Foo depends on version 1 of Bar, and Baz

App1 > Lib1 Lib2-v2

Lib1 > Lib2-v1

When Lib1 runs its tests, it runs them against v1 of Lib2. However, when App1 runs, it runs with v2 of Lib2. This means Lib1 is running against code it is not tested against. It would be nice if there is a way to run Lib1’s tests from App1 so gradle will do the version resolution to make Lib1 tested against the version of Lib2 that will be in the application. Is there a way gradle can help achieve this specifically for Android apps?