Created
May 21, 2019 10:25
-
-
Save voghDev/1f3e6066b007146c630946215b67d3da to your computer and use it in GitHub Desktop.
createTestResources method to configure MockMaker for Android Kotlin projects. Compatible with Gradle 5+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task createTestResources { | |
description = "Allows Mocking non-final classes and data classes in a Kotlin project" | |
doLast { | |
def mockMakerFile = new File("$projectDir/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker") | |
if (System.env.MOCK_MAKER != null) { | |
logger.info("Using MockMaker ${System.env.MOCK_MAKER}") | |
mockMakerFile.parentFile.mkdirs() | |
mockMakerFile.createNewFile() | |
mockMakerFile.write(System.env.MOCK_MAKER) | |
} else { | |
logger.info("Using default MockMaker") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment