I have a class call ProductRegister that has a method
private List<Product> products = new CopyOnWriteArrayList<>();
void registerProduct(Product p) {
products.add(p);
}
Bearing in mind products is private with no getter, and is created inside the class, how do I unit test this? I've considered adding a getter but isn't that exposing internal logic that I don't want others to know about?