storeCatalogStub = Stub<StoreCatalog> { getProductsForUserId(USER_ID) <= PRODUCTS } val storeMock = Mock<ProductStore>() val purchaseHistoryMock: PurchaseHistory = Mock() fun `Purchase correct product available in the store`() { given("A valid user") { userService.isValidUser(USER_ID) <= true } `when`("The user tries to do the purchase") { purchaseOperation.perform(USER_ID, PRODUCT_ID) } then("Product is purchased") { 1 * storeMock.purchaseProduct(USER_ID, PRODUCT_ID, null.not()) <= OK_RESULT } and("Operation is logged") { (1..any) * purchaseHistoryMock.logProductPurchased(USER_ID, PRODUCT_ID, any()) } and("No more interactions") { 0 * any } } Operator overloading Reified generics Extension functions https://github.com/Koxalen