j2objc-contrib / j2objc-gradle

This plugin is no longer actively maintained. J2ObjC Gradle Plugin: enables Java source to be part of an iOS application's build so you can write an app's non-UI code (such as application logic and data models) in Java, which is then shared by Android apps (natively Java) and iOS apps (using J2ObjC), all as part of your usual Android Gradle build.
https://github.com/j2objc-contrib/j2objc-gradle
Apache License 2.0
139 stars 43 forks source link

Replace MockProjectExec by mocking with Spock #475

Open brunobowden opened 8 years ago

brunobowden commented 8 years ago

MockFor can't mock project.exec due to a bug in Groovy failing to support mocking of interfaces using metaClass programming. The Spock framework however uses JDK Dynamic Proxies which may work instead:

http://spockframework.github.io/spock/docs/1.0/interaction_based_testing.html

Like most Java mocking frameworks, Spock uses JDK dynamic proxies (when mocking interfaces) and CGLIB proxies (when mocking classes) to generate mock implementations at runtime. Compared to implementations based on Groovy meta-programming, this has the advantage that it also works for testing Java code.

Framework needed:

testCompile('org.spockframework:spock-core:1.0-groovy-2.3')
brunobowden commented 8 years ago

Gradle Forum discussion: https://discuss.gradle.org/t/support-mocking-project-exec-currently-impossible-due-to-groovy-bug/11975