Copilot commented on code in PR #13654:
URL: https://github.com/apache/cloudstack/pull/13654#discussion_r3683522747


##########
server/src/test/java/com/cloud/deploy/DeploymentPlanningManagerImplTest.java:
##########
@@ -227,6 +229,12 @@ public class DeploymentPlanningManagerImplTest {
     @Inject
     HostPodDao _podDao;
 
+    @Inject
+    HostDao _hostDao;
+
+    @Mock
+    AffinityGroupDao _affinityGroupDao;

Review Comment:
   `_affinityGroupDao` is declared as `@Mock` while other collaborators are 
`@Inject`ed (presumably from the Spring test context). Unless this test class 
is explicitly initializing Mockito annotations and also wiring this exact mock 
into `_dpm`, stubbing `Mockito.when(_affinityGroupDao...)` may not affect the 
`DeploymentPlanningManagerImpl` instance under test (or `_affinityGroupDao` 
could remain null). Prefer using the same injection mechanism as the rest of 
the test (e.g., provide a mocked `AffinityGroupDao` bean in the test 
configuration and `@Inject` it), or ensure the mock is injected into `_dpm` via 
the test’s wiring.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to