How would you refactor the following if the products can be returned in any order?
List<Product> products = get_products("test_produc");
assertEquals(products.size(),3);
assertEquals(products.get(0).getName(), "test_product1");
assertEquals(products.get(1).getName(), "test_product2");
assertEquals(products.get(2).getName(), "test_produc3");
If it can be done elegantly using streams then I'm oopen to such suggestions. Hamcrest suggestions are also welcome.