diff --git a/src/ii_conventions/_17_Invoke_.kt b/src/ii_conventions/_17_Invoke_.kt index 5dedac3..e09c308 100644 --- a/src/ii_conventions/_17_Invoke_.kt +++ b/src/ii_conventions/_17_Invoke_.kt @@ -30,7 +30,17 @@ fun testTypeWithInvokeExtension() { 1() //huh?.. } -class Invokable +class Invokable { + private var number = 0 + operator fun invoke() : Invokable { + number += 1 + return this + } + + fun getNumberOfInvocations() : Int { + return number + } +} fun todoTask17(): Nothing = TODO( """ @@ -41,6 +51,5 @@ fun todoTask17(): Nothing = TODO( references = { invokable: Invokable -> }) fun task17(invokable: Invokable): Int { - todoTask17() -// return invokable()()()().getNumberOfInvocations() + return invokable()()()().getNumberOfInvocations() } diff --git a/test/ii_conventions/_17_Invoke.kt b/test/ii_conventions/_17_Invoke.kt index b64f9d6..2918de8 100644 --- a/test/ii_conventions/_17_Invoke.kt +++ b/test/ii_conventions/_17_Invoke.kt @@ -1,6 +1,6 @@ package ii_conventions -import junit.framework.Assert +import org.junit.Assert import org.junit.Test as test class _17_Invoke {