Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlicanAkkus/f4dfb530eafa6dc12a6751264b378bb8 to your computer and use it in GitHub Desktop.
Save AlicanAkkus/f4dfb530eafa6dc12a6751264b378bb8 to your computer and use it in GitHub Desktop.
spock test with bdd style
class OrderCommissionCalculatorTest extends Specification {
def orderCommissionCalculator = new OrderCommissionCalculator()
void "should calculate card payment order commission"() {
given: "card payment and price is 100"
def paymentType = "CARD"
def price = 100
when: "calculate card payment commission"
def commissionAmount = orderCommissionCalculator.calculate(paymentType, price)
then: "commission should equal to 2.3"
commissionAmount == 2.3
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment