This file contains hidden or 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
object ExampleSpec : Spek({ | |
describe("simple test") { | |
it("returns true") { | |
assertTrue(true) | |
} | |
} | |
}) |
This file contains hidden or 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
@Mock | |
Activity mock |
This file contains hidden or 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
@RunWith(RobolectricTestRunner.class) | |
public class MyActivityTest { | |
} |
This file contains hidden or 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
private val mContext = mockk<Context> |
This file contains hidden or 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
class IronManMk1 { | |
fun getRepulsorsStatus() { | |
println("jarvis: repulsors no power") | |
} | |
val repulsorsStatus = println("jarvis: repulsors no power") | |
} |
This file contains hidden or 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
class IronManMk2 { | |
fun getRepulsorsStatus() { | |
println("jarvis: ready power 100") | |
} | |
val repulsorsStatus get() = println("jarvis: ready power 90") | |
} |
This file contains hidden or 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
class IronManMk1Debug { | |
fun shoot() { | |
println("jarvis: target destroyed") | |
} | |
fun getRepulsorsStatus() { | |
println("jarvis: repulsors no power") | |
} | |
val repulsorsStatus = println("jarvis: repulsors no power") |
This file contains hidden or 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
buildscript { | |
ext.jacocoVersion = '0.8.7' | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath "org.jacoco:org.jacoco.core:$jacocoVersion" |
This file contains hidden or 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
apply plugin: 'jacoco' | |
android { | |
debug { | |
// this line will add new task createDebugCoverageReport that needed by jacoco | |
// however as default it will generate coverage for androidTest | |
// it does not generate coverage for unitTest | |
testCoverageEnabled true | |
} | |
} |
This file contains hidden or 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 jacocoTestCoverageVerification(type: JacocoCoverageVerification, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { | |
group = "Verification" | |
description = "Check code coverage" | |
onlyIf = { | |
true | |
} | |
violationRules { | |
rule { |