Skip to content

[Rinse and Repeat] Parameter passing #256

@pehunka

Description

@pehunka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions