up private val testee: CreditCardManager @Test fun givenCreditCard_whenCharge_thenReturnSuccess() { // given val creditCard = CreditCard(balance = 12) // when val result = testee.charge(creditCard = creditCard) // then assertResultSuccess(result = result) } }
Result { val processor: CreditCartProcessor = CreditCardProcessor() processor.extractCardNumber(creditCard) val info = cardInfoManager.processPrechargeInfo() return this.updateChargeInfo(info) } fun updateChargeInfo(info: PrechargeInfo): Result { ... } }