Created the tests for the navbar interactor#178
Merged
matthew-SG merged 1 commit intomainfrom Dec 3, 2025
Merged
Conversation
…enter file since navbar does not have anything that implements its output boundary in its use case, i.e. it does not have its own presenter.
matthew-SG
approved these changes
Dec 3, 2025
Owner
matthew-SG
left a comment
There was a problem hiding this comment.
Yeah that makes sense. Appreciate you writing the tests.
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.
Summary
This pull request introduces a complete JUnit test suite for the NavbarInteractor, along with a mock presenter implementation (NavbarMockPresenter). These tests ensure that navigation requests made through the interactor are correctly delegated to the corresponding presenter methods defined in NavbarOutputBoundary.
Key Additions
- Individual tests for each navigation method:
- switchToLogin
- switchToSignUp
- switchToCommunity
- switchToGenerateRecipe
- switchToApproveRecipe
- switchToProfile
- switchToGroceryList
- switchToMealPlan
- switchToSearchByIngredients
- switchToLikedRecipeList
- Tracks the last view switched via a lastViewSwitched field.
- Provides getter for test assertions.
- Implements all navigation methods expected by the interactor.
Motivation
The navigation system is a key component of the application's user flow.
Prior to this PR, the NavbarInteractor lacked automated tests, leaving its correctness unverified.
This addition improves:
- Reliability of navigation handoff logic
- Confidence in future refactoring
- Compliance with clean architecture testing principles
Testing
All tests pass successfully.
I also checked for 100% line coverage for the interactor.
Files Added
src/test/java/use_case/nav_bar/NavbarInteractorTests.java
src/test/java/use_case/nav_bar/NavbarMockPresenter.java
Impact
No production code is modified.
This PR enhances test coverage and ensures the navigation interactor behaves as designed.