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


##########
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 a plain Mockito `@Mock`, while other 
collaborators are `@Inject`-ed. If `DeploymentPlanningManagerImpl` is wired via 
the Spring test context (as it appears from the `@Configuration/@ComponentScan` 
in this test), the `_dpm` bean likely won’t use this `@Mock` instance, so 
stubbing `findDomainLevelGroupByType(...)` may not affect the code under test. 
Prefer providing `AffinityGroupDao` as an injected mocked bean in the test 
context (consistent with the other DAOs), or switch to a pure Mockito 
`@InjectMocks` setup so the mock is actually used.



-- 
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