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.
…dhere to clean architecture. So, had to change some of the test files as well
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
checkstyle
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.imports.RedundantImportCheck> reported by reviewdog 🐶
Redundant import from the same package - use_case.nav_bar.NavbarOutputBoundary.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck> reported by reviewdog 🐶
Variable 'lastViewSwitched' explicitly initialized to 'null' (default value for its type).
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck> reported by reviewdog 🐶
Name 'use_case.nav_bar' must match pattern '^[a-z]+(.[a-zA-Z_]\w*)*$'.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck> reported by reviewdog 🐶
Import statement for 'org.junit.jupiter.api.Assertions.*' is in the wrong order. Should be in the 'STATIC' group, expecting not assigned imports on this line.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck> reported by reviewdog 🐶
Wrong order for 'org.junit.jupiter.api.Assertions.*' import.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck> reported by reviewdog 🐶
Using the '.' form of import should be avoided - org.junit.jupiter.api.Assertions..
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'instructions' should be declared final.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck> reported by reviewdog 🐶
Catching 'Exception' is not allowed.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'speechService' should be declared final.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'interactor' should be declared final.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.naming.LambdaParameterNameCheck> reported by reviewdog 🐶
Name 'e' must match pattern '^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$'.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'propertyName' should be declared final.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'newState' should be declared final.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'newState' should be declared final.
| assertEquals(1, output.stepNumber()); | ||
| assertTrue(output.hasNext()); | ||
| assertFalse(output.hasPrevious()); | ||
| assertEquals("Heat the oven to 350°F", output.getStepText()); |
There was a problem hiding this comment.
🚫 [checkstyle] reported by reviewdog 🐶
Line matches the illegal pattern '[^\p{ASCII}]'.
| // Arrange | ||
| RecipeInstructions emptyInstructions = new RecipeInstructions(Collections.emptyList()); | ||
| StepByStepInputData inputData = new StepByStepInputData(emptyInstructions, 0); | ||
| RecipeInstructions instructions = new RecipeInstructions(sampleSteps); |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'instructions' should be declared final.
| RecipeInstructions emptyInstructions = new RecipeInstructions(Collections.emptyList()); | ||
| StepByStepInputData inputData = new StepByStepInputData(emptyInstructions, 0); | ||
| RecipeInstructions instructions = new RecipeInstructions(sampleSteps); | ||
| StepByStepInputData inputData = new StepByStepInputData(instructions, 2); |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'inputData' should be declared final.
| assertFalse(mockPresenter.isPresentCalled(), "Present should not be called for empty steps"); | ||
| assertTrue(mockPresenter.isSuccessViewCalled()); | ||
|
|
||
| StepByStepOutputData output = mockPresenter.getLastOutputData(); |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'output' should be declared final.
| // Arrange | ||
| RecipeInstructions nullInstructions = new RecipeInstructions(null); | ||
| StepByStepInputData inputData = new StepByStepInputData(nullInstructions, 0); | ||
| RecipeInstructions instructions = new RecipeInstructions(sampleSteps); |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'instructions' should be declared final.
| /** | ||
| * Mock speech service for testing | ||
| */ | ||
| private static class MockSpeechService implements SpeechService { |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.FinalClassCheck> reported by reviewdog 🐶
Class MockSpeechService should be declared as final.
| * Mock speech service for testing | ||
| */ | ||
| private static class MockSpeechService implements SpeechService { | ||
| private boolean synthesizeCalled = false; |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck> reported by reviewdog 🐶
Variable 'synthesizeCalled' explicitly initialized to 'false' (default value for its type).
| */ | ||
| private static class MockSpeechService implements SpeechService { | ||
| private boolean synthesizeCalled = false; | ||
| private String lastTextSpoken = null; |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck> reported by reviewdog 🐶
Variable 'lastTextSpoken' explicitly initialized to 'null' (default value for its type).
| private static class MockSpeechService implements SpeechService { | ||
| private boolean synthesizeCalled = false; | ||
| private String lastTextSpoken = null; | ||
| private boolean shouldFail = false; |
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck> reported by reviewdog 🐶
Variable 'shouldFail' explicitly initialized to 'false' (default value for its type).
| @@ -0,0 +1,70 @@ | |||
| package use_case.nav_bar; | |||
There was a problem hiding this comment.
🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.naming.PackageNameCheck> reported by reviewdog 🐶
Name 'use_case.nav_bar' must match pattern '^[a-z]+(.[a-zA-Z_]\w*)*$'.
matthew-SG
left a comment
There was a problem hiding this comment.
I like the changes you made. Since the checkstyle issues appear to be mainly for your tests, I'll approve the merge.
There was a problem hiding this comment.
I see you added more test cases which is good, please address the checkstyle issues though. I noticed your step by step interactor assumes steps is never empty or null, is this always the case? Because if it is empty or the index is out of range it'll throw before the fail view is reached you should probably add these edge cases in your tests too. Also i wanted to mention in the StepbyStep presenter an and the view model both have different fail views with very similar behaviour it might be better to merge these into a single error path.
hussssni
left a comment
There was a problem hiding this comment.
This is the best code I've ever seen
|
We have three approvals, I'm vetoing it. |
Summary
This pull request introduces full text-to-speech (TTS) support to the step-by-step recipe flow using a new SpeechService abstraction and a concrete SystemTTS implementation. In addition, it applies substantial refactoring across interactors, presenters, state objects, and view models to restore clean architectural boundaries and ensure consistent and testable behavior.The PR also resolves several defects, removes obsolete code, and adds a complete test suite for the navbar interactor.
Key Changes
Step-By-Step Module Refactor and TTS Integration
Controller : Added speak() method to trigger TTS through the interactor.
Interactor:
Presenter:
Additional Fixes
Tests
- NavbarInteractorTests
- NavbarMockPresenter
- All navigation routes
- Sequential navigation calls
- Correct delegation to presenter
Rationale
Brings the step-by-step module back into alignment with Clean Architecture.
Introduces consistent and testable TTS behavior.
Reduces duplication, improves maintainability, and fixes existing defects.
Adds missing tests for key navigation functionality.
Impact
No external API changes outside the step-by-step use case.
All existing UI components remain functional with improved consistency and reliability.