I removed the Paparazzi plugin from one of my modu...
# squarelibraries
e
I removed the Paparazzi plugin from one of my modules, and now unrelated tests are failing with errors about Android classes not being mocked. Adding
android.testOptions.unitTest.isReturnDefaultValues = true
fixes the problem. Does the Paparazzi plugin do something to transform all tests in a module where the plugin is applied?
j
No. But it adds a layout lib dependency.
e
Does that provide a mocked Android library? The test that fails now should just be a regular junit 4 test.
j
It's the real Android code
You'd need to add the layout lib dependency yourself to retain the behavior, or to use something like Robolectric which also is the real Android code.
Or if you're not relying on the actual Android codepaths you can do the mock jar
e
Copy code
class FooTest {
  @Test 
  fun testFoo() { 
    val foo = Foo() // calls Log.d()
  }
}
I never realized that
Log.d
was getting called, but the test always worked because layoutlib was present in the dependencies, and it's version of
Log.d
was being used?
j
Yep. Which is probably empty.
e
Cool, thanks