Skip to content

Update ApproveRecipeInteractorTest.java#174

Merged
Adish-Singh merged 1 commit intomainfrom
approve-test-case
Dec 2, 2025
Merged

Update ApproveRecipeInteractorTest.java#174
Adish-Singh merged 1 commit intomainfrom
approve-test-case

Conversation

@hussssni
Copy link
Copy Markdown
Collaborator

@hussssni hussssni commented Dec 2, 2025

No description provided.

private static class TestApproveRecipeDAO implements ApproveRecipeDataAccessInterface {
private List<Recipe> availableRecipes = new ArrayList<>();
private Map<String, User> users = new HashMap<>();
private boolean shouldThrowOnGetRecipes = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck> reported by reviewdog 🐶
Variable 'shouldThrowOnGetRecipes' explicitly initialized to 'false' (default value for its type).

private List<Recipe> availableRecipes = new ArrayList<>();
private Map<String, User> users = new HashMap<>();
private boolean shouldThrowOnGetRecipes = false;
private boolean shouldThrowOnSave = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck> reported by reviewdog 🐶
Variable 'shouldThrowOnSave' explicitly initialized to 'false' (default value for its type).

private Map<String, User> users = new HashMap<>();
private boolean shouldThrowOnGetRecipes = false;
private boolean shouldThrowOnSave = false;
private boolean shouldThrowOnRemove = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.ExplicitInitializationCheck> reported by reviewdog 🐶
Variable 'shouldThrowOnRemove' explicitly initialized to 'false' (default value for its type).

public TestApproveRecipeDAO() {
// Create test user
User testUser = new User("testUser", "password", new ArrayList<>(),
User testUser = new User("testUser", "password", new ArrayList<>(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'testUser' should be declared final.

assertEquals(0, dao.getUser("testUser").getSavedRecipes().size());
}

@Test
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck> reported by reviewdog 🐶
Init blocks, constructors, fields and methods should be before inner types.

@Test
void testApproveRecipeInputDataGetters() {
// Create input data and verify getters
ApproveRecipeInputData inputData = new ApproveRecipeInputData(123, "testUser");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'inputData' should be declared final.

assertEquals("testUser", inputData.getUsername());
}

@Test
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck> reported by reviewdog 🐶
Init blocks, constructors, fields and methods should be before inner types.

@Test
void testDeclineRecipeInputDataGetters() {
// Create input data and verify getters
DeclineRecipeInputData inputData = new DeclineRecipeInputData(456, "testUser");
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'inputData' should be declared final.

assertEquals("testUser", inputData.getUsername());
}

@Test
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.design.InnerTypeLastCheck> reported by reviewdog 🐶
Init blocks, constructors, fields and methods should be before inner types.

@Test
void testApproveRecipeOutputDataCurrentIndexAfterApproval() {
// Setup
List<Recipe> recipes = new ArrayList<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck> reported by reviewdog 🐶
Variable 'recipes' should be declared final.

Copy link
Copy Markdown
Collaborator

@Adish-Singh Adish-Singh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests have 100% line coverage, so good job.

@Adish-Singh Adish-Singh merged commit 3f2eb5b into main Dec 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants