Skip to content

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

Open
pehunka wants to merge 1 commit intoarquillian:masterfrom
pehunka:master
Open

fix #256 from arquillian / arquillian.github.com#8
pehunka wants to merge 1 commit intoarquillian:masterfrom
pehunka:master

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