Question: Why is unit testing harder in OOP than functional programming?
- Objects may maintain internal state, which is not easily accessible by the tests.
- The quality of unit testing frameworks for functional languages is better.
- OOP promotes code reuse, which means that your tests have to consider more use cases.
- Object-oriented languages tend to rely on frameworks such as Spring or Hibernate, which make them difficult to test.
Answer: The correct answer of the above question is Option A:Objects may maintain internal state, which is not easily accessible by the tests.