[UnitTest] @Self Annotation using Mangeto and a CIF Model within custom Model | Community
Skip to main content
Level 2
June 1, 2022

[UnitTest] @Self Annotation using Mangeto and a CIF Model within custom Model

  • June 1, 2022
  • 2 replies
  • 851 views

Hi Community, 

 

I'm trying to write my Unit test for a model created to interact with the MagentoGraphqlClient Object. 

My doubt here comes when I need to inject a mocked object using the @1961677  annotation.

 

@Self(injectionStrategy = InjectionStrategy.OPTIONAL)
private MagentoGraphqlClient magentoGraphqlClient;

 Also for a CIF Model that is being called within my custom model.

@Self(injectionStrategy = InjectionStrategy.OPTIONAL)
@Via(type = ResourceSuperType.class)
private com.adobe.cq.commerce.core.components.models.productlist.ProductList productList;

 Does anybody have any idea how can I inject these mocked objects and interact with the returning values within my Model?

 

Regards.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

naxtyn__1Author
Level 2
June 1, 2022

Thanks for sharing this information, I did take a look before but this is not providing too much information about this case. 

arunpatidar
Community Advisor
Community Advisor
June 2, 2022