Skip to content

Modified EscalationRepositoryTest class to include WorkflowUtil bean. #751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.List;

import org.egov.wf.repository.querybuilder.EscalationQueryBuilder;
import org.egov.wf.util.WorkflowUtil;
import org.egov.wf.web.models.EscalationSearchCriteria;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand All @@ -33,6 +34,9 @@ class EscalationRepositoryTest {
@MockBean
private JdbcTemplate jdbcTemplate;

@MockBean
private WorkflowUtil util;
Comment on lines +37 to +38
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify necessity and naming of the new mock bean

You’ve added a @MockBean private WorkflowUtil util; to satisfy the repository’s dependency, but the field is currently unused in the test. Please:

  1. Confirm that EscalationRepository actually autowires and uses WorkflowUtil in the production code.
  2. Rename util to workflowUtil for clarity and consistency with the class name.
  3. Stub or verify interactions with this mock in existing or new test methods if needed.

🏁 Script executed:

#!/bin/bash
# Check if EscalationRepository uses WorkflowUtil
rg -n "WorkflowUtil" core-services/egov-workflow-v2/src/main/java/org/egov/wf/repository/EscalationRepository.java

Length of output: 308


Confirm and refine the WorkflowUtil mock in EscalationRepositoryTest

The EscalationRepository constructor does inject a WorkflowUtil instance (see lines 25 and 28 in EscalationRepository.java), so supplying a @MockBean is needed to load the Spring test context—but the mock is currently unused in your tests. Please:

• In
core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/EscalationRepositoryTest.java
– rename the field from util to workflowUtil (lines 37–38) for clarity.
• If any repository methods under test call into WorkflowUtil, stub or verify those interactions on workflowUtil.
• If none of the exercised code paths invoke WorkflowUtil, consider removing the unused mock altogether.

🤖 Prompt for AI Agents
In
core-services/egov-workflow-v2/src/test/java/org/egov/wf/repository/EscalationRepositoryTest.java
around lines 37 to 38, the mock bean for WorkflowUtil is currently unused and
named 'util', which reduces clarity. Rename the field to 'workflowUtil' for
consistency with the class name, and verify if the test methods invoke any
methods on this mock; if so, stub or verify those interactions. If the mock is
not used in any test, consider removing it to clean up the test class.


@Test
void testGetBusinessIds() throws DataAccessException {
ArrayList<Object> objectList = new ArrayList<>();
Expand Down