Refactor code for improved readability and maintainability#21
Merged
Conversation
- Changed public class declarations to package-private for test classes. - Introduced constants for repeated string literals (e.g., admin username). - Simplified XML file loading logic in PostDataRepository. - Added helper methods in NutritionParserTest to reduce assertion count and improve readability. - Updated FXML test cases to use text blocks for better formatting. - Ensured consistent method visibility across test classes.
…rameter and improve readability
…hods - Updated PostDataRepositoryTest to replace direct field access with getter/setter methods for likecount, commentcount, and isLiked. - Modified PostLikedStateTest to utilize getter/setter methods for post attributes. - Refactored PostTest to ensure all field assertions use getter/setter methods. - Adjusted UserDataRepositoryTest to implement getter/setter methods for user attributes. - Revised UserTest to access user fields through getter/setter methods. - Enhanced ChatHistoryManagerTest to utilize getter methods for message attributes. - Updated NutritionParserTest to replace direct field access with getter methods for nutrition attributes. - Refactored SessionTest to ensure user attributes are accessed via getter/setter methods.
…troller and UserDataRepositoryTest
…troller and UserDataRepositoryTest
… image loading utility and improve data persistence exception handling
…ity and maintainability - Consolidated duplicated string literals into constants in PostController. - Introduced dedicated exception for nutrition analysis retries. - Refactored UI update methods in PostController for clarity and separation of concerns. - Simplified nutrition facts population logic and added helper methods for better structure. - Updated logging to use lambda expressions for deferred message construction. - Enhanced error handling in ChatHistoryManager and FileSystemManager with clearer logging. - Refactored image path resolution logic in FileSystemManager to reduce complexity. - Improved fallback image handling and logging consistency across the application. - Updated PostItemController and RecipeItemController to use a unified method for opening posts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enhance code structure by updating class visibility, utilizing getter and setter methods, and simplifying logic across various components. Improve exception handling and logging consistency while ensuring better formatting in tests and controllers. Address minor issues to further refine the codebase.