Let assume I have two simple model classes: Product and BrandIt is obvious I have a query method in Product  class like thisProduct product = Product.findById(123);What if, I want to query products by brand?ArrayList<Product> products = Product.findByBrand(234);// orArrayList<Product> products = Product.findByBrand(new Brand(ABC, 234));Assume 234 is the brand ID in the database.I assume the 2nd way of writing make the method more easy to test as I can mock the Brand class in my unit test, right?
Domain object model: query by id vs object
java;object oriented;unit testing;domain model;mocking