You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor TkClasspathTest for object-oriented exception handling and better expressiveness (relates to #1408)
The test class TkClasspathTest violates several object-oriented design principles discussed in the Pain of OOP course:
Procedural error handling:
The use of Assertions.assertThrows(...) relies on capturing exceptions with lambdas, which is a procedural approach. Instead, object-based handling using something like TkFailure or RsFailure would align better with object-oriented thinking.
Low-level request construction:
The test constructs fake requests using raw strings (e.g., "PUT", "/something-else"). This violates the object-oriented idea that everything is an object. Using decorators like RqWithMethod, RqWithUri improves clarity and encapsulation.
Suggested Improvements
Replace assertThrows(...) with an object-oriented failure handling strategy where possible.
Replace string-based request setup with composable request objects.