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

[Rinse and Repeat] Parameter passing #256

Closed
pehunka opened this issue Nov 13, 2013 · 5 comments
Closed

[Rinse and Repeat] Parameter passing #256

pehunka opened this issue Nov 13, 2013 · 5 comments

Comments

@pehunka
Copy link

pehunka commented Nov 13, 2013

Hi,

I think I found a bug in Basket class

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

@mojavelinux
Copy link
Member

Absolutely correct. The items collection needs to be copied when it is passed to addOrder. The assertion should also go deeper so that this error would get caught.

Willing to send a pull request with the correct code sample?

@pehunka
Copy link
Author

pehunka commented Nov 25, 2013

Hi Dan,

already did :-) Its pull request num.8 in arquillian-examples repo.. If you need send pull request here, just tell me..

@mojavelinux
Copy link
Member

Oh, perfect! I'll link it to this issue.

arquillian/arquillian-examples#8

@mojavelinux
Copy link
Member

The change also needs to be made in the guide itself. Did you create a pull request already for the guide?

@pehunka
Copy link
Author

pehunka commented Nov 25, 2013

Not yet :-) I have not environment that is needed for page editing (Ruby), but maybe I will find some spare time on this weekend. Also I found some code that need polish in functional testing guide (its not working -> wrong ids of page elements). So I send it also.

Btw. if you are interested for some vaadin 7 + graphene + drone code example, I have one :-) It's combination of functional testing and persistence examples.. I was preparing presentation about arquillian for our department and I need to prep some examples :-)

@pehunka pehunka closed this as completed Dec 29, 2022
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

No branches or pull requests

2 participants