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

fix #256 from arquillian / arquillian.github.com #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix #256 from arquillian / arquillian.github.com #8

wants to merge 1 commit into from

Conversation

pehunka
Copy link

@pehunka pehunka commented Nov 13, 2013

Basket class contains List<String> of items. Function basket.placeOrder() pass this item's list to another list inside SingletonOrderRepository.class and than this list is cleared via items.clear(). This is problem because value is pass via reference copy and list inside SingletonOrderRepository is cleared also.

Arquillian's tests looks ok on first sight because they testing only size not what they are really holding inside.

You need eather
items = new ArrayList<String>() instead of items.clear() inside Basket.class

or

orders.add(new ArrayList<String>(order));
instead of orders.add(order); inside SingletonOrderRepository.class

- SingletoneOrderRepository list orders was empty because of wrong pass by reference in basket.placeOrder()
- new Assert that ensure that list inside SingletoneOrderRepository contains items from basket
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.

1 participant