Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing Cucumber Scenario. Exercise 1 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ninitha701
Copy link

@wakaleo Ready For review

Copy link
Contributor

@wakaleo wakaleo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Ninitha!

<artifactId>cucumber-java</artifactId>
<version>6.9.1</version>
<scope>test</scope>
</dependency>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful, you have this dependency twice - you only need the second one.

public List<Order_NB> getUrgentOrders() {
List<Order_NB> results = new ArrayList<>();
for(int i=0;i<receivedOrders.size();i++) {
if (receivedOrders.get(i).getOrderStatus()=="Urgent")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When comparing Strings in Java, don't forget to use the equals() method, e.g. if (receivedOrders.get(i).getOrderStatus().equals("Urgent"))

break;
}
}
return receivedOrders.get(i).getOrderStatus();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good but you'll learn easier ways to write this code later on in the course.

public void sarah_should_see_the_order_in_her_order_history() {
assertThat(customer.getOrderHistoryFor(orderReceipt.getCustomerId())).contains(Order.matching(orderReceipt));
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

}

public void completeOrder(OrderReceipt orderReceipt) {
coffeeOrders.getOrders().stream().filter(order -> order.getCustomerId()==orderReceipt.getCustomerId())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would work if customerId was a number, but if it is a string it is better to use equals()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants