Skip to content

Instantly share code, notes, and snippets.

View mario-rezende-ifood's full-sized avatar

Mario Rezende mario-rezende-ifood

  • iFood
  • Sao Paulo / Brazil
View GitHub Profile
Condition not satisfied:
Math.max(a, b) == c
| | | | | |
| 7 7 4 | 4
| false
class java.lang.Math
def 'Maximum of two numbers'() {
expect:
Math.max(a, b) == c
where:
a | b | c
1 | 3 | 3
7 | 4 | 4
0 | 0 | 0
given: 'open a database connection'
// code goes here
and: 'seed the customer table'
// code goes here
and: 'seed the product table'
// code goes here
then:
name == 'Fulano'
name != 'Beltrano'
age >= 20
age < 100
def 'Allow user access only for 18 over'(name, age, expected) {
given: 'user entity'
def user = new User(name, age)
when: 'validate user access'
def userCanAccess = AccessService().grantUser(user)
then:
userCanAccess == expected
def 'Validate user registration'() {
given: 'user data'
def name = "Fulano"
def age = 20
def email = "[email protected]"
when: 'register the user'
def user = UserService().register(name, age, email)
@Test
void validateUserRegistration() {
// setup
String name = "Fulano"
int age = 20
String email = "[email protected]"
// execute
User user = UserService().register(name, age, email)