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);
}
}
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);
}
}
Aggregations