Search in sources :

Example 11 with Step

use of net.thucydides.core.annotations.Step in project podam by devopsfolks.

the class WalkThroughSteps method theOrderPojoShouldBeCorrectlyFilled.

@Step("Then the Order POJO should be correctly filled")
public void theOrderPojoShouldBeCorrectlyFilled(Order pojo) {
    assertThat("The pojo cannot be null!", pojo, not(nullValue()));
    assertThat("The order id must not be zero!", pojo.getId(), not(equalTo(0)));
    Calendar createDate = pojo.getCreateDate();
    assertThat("The create date must not be null!", createDate, not(nullValue()));
    assertThat("The order total amount must not be zero!", pojo.getTotalAmount(), not(equalTo(0.0)));
    List<OrderItem> orderItems = pojo.getOrderItems();
    assertThat("The order items must not be null!", orderItems, not(nullValue()));
    assertThat("The order items must not be empty!", orderItems, is(not(empty())));
    int expectedNbrElements = 5;
    assertThat("The expected number of elements " + expectedNbrElements + " does not match the actual number: " + orderItems.size(), orderItems, hasSize(expectedNbrElements));
    for (OrderItem orderItem : orderItems) {
        theOrderItemPojoShouldBeCorrectlyFilled(orderItem);
    }
}
Also used : Calendar(java.util.Calendar) OrderItem(uk.co.jemos.podam.test.dto.docs.example.OrderItem) Step(net.thucydides.core.annotations.Step)

Example 12 with Step

use of net.thucydides.core.annotations.Step in project podam by devopsfolks.

the class WalkThroughSteps method theClientPojoShouldBeCorrectlyFilled.

@Step("Then the Client POJO should be correctly filled")
public void theClientPojoShouldBeCorrectlyFilled(Client pojo) {
    assertThat("The pojo cannot be null!", pojo, not(nullValue()));
    assertThat("The client's first name cannot be empty!", pojo.getFirstName(), not(isEmptyOrNullString()));
    String expectedFirstName = "Michael";
    assertThat("The client's first name is not " + expectedFirstName, pojo.getFirstName(), equalTo(expectedFirstName));
    assertThat("The client's last name cannot be empty!", pojo.getLastName(), not(isEmptyOrNullString()));
    assertThat("The date created cannot be null!", pojo.getDateCreated(), not(nullValue()));
    List<Order> orders = pojo.getOrders();
    assertThat("The orders cannot be null!", orders, not(nullValue()));
    int expectedOrdersNbr = 3;
    assertThat("The expected number of orders is " + expectedOrdersNbr, orders, hasSize(expectedOrdersNbr));
    for (Order order : orders) {
        theOrderPojoShouldBeCorrectlyFilled(order);
    }
    List<Address> addresses = pojo.getAddresses();
    assertThat("The addresses cannot be null!", addresses, not(nullValue()));
    int expectedAddressesNbr = 2;
    assertThat("The expected number of addresses is " + expectedAddressesNbr, addresses, hasSize(expectedAddressesNbr));
    for (Address address : addresses) {
        theAddressPojoShouldBeCorrectlyFilled(address);
    }
    List<BankAccount> bankAccounts = pojo.getBankAccounts();
    for (BankAccount bankAccount : bankAccounts) {
        theBankAccountPojoShouldBeCorrectlyFilled(bankAccount);
    }
}
Also used : Order(uk.co.jemos.podam.test.dto.docs.example.Order) Address(uk.co.jemos.podam.test.dto.docs.example.Address) BankAccount(uk.co.jemos.podam.test.dto.docs.example.BankAccount) Step(net.thucydides.core.annotations.Step)

Aggregations

Step (net.thucydides.core.annotations.Step)12 Annotation (java.lang.annotation.Annotation)2 Type (java.lang.reflect.Type)2 Calendar (java.util.Calendar)2 DataProviderStrategy (uk.co.jemos.podam.api.DataProviderStrategy)2 CustomRandomDataProviderStrategy (uk.co.jemos.podam.test.strategies.CustomRandomDataProviderStrategy)2 CustomDataProviderStrategy (uk.co.jemos.podam.test.unit.features.inheritance.CustomDataProviderStrategy)2 BigDecimal (java.math.BigDecimal)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 Random (java.util.Random)1 HttpResponse (org.apache.http.HttpResponse)1 ClassAttribute (uk.co.jemos.podam.api.ClassAttribute)1 RecursivePojo (uk.co.jemos.podam.test.dto.RecursivePojo)1 Address (uk.co.jemos.podam.test.dto.docs.example.Address)1 BankAccount (uk.co.jemos.podam.test.dto.docs.example.BankAccount)1 Order (uk.co.jemos.podam.test.dto.docs.example.Order)1 OrderItem (uk.co.jemos.podam.test.dto.docs.example.OrderItem)1