Skip to content

Commit 709ec54

Browse files
author
dhrsharm
committed
feat(print-cc): Adding test case
1 parent cfb2f98 commit 709ec54

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/util/AbstractFormComponentImplTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import com.adobe.cq.forms.core.Utils;
3232
import com.adobe.cq.forms.core.components.internal.form.FormConstants;
33+
import com.adobe.cq.forms.core.components.models.form.print.dorapi.DorContainer;
3334
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
3435
import com.day.cq.wcm.api.Page;
3536
import com.day.cq.wcm.api.PageManager;
@@ -185,4 +186,21 @@ private AbstractFormComponentImpl prepareTestClass(String path) {
185186
Utils.setInternalState(abstractFormComponentImpl, "resource", resource);
186187
return abstractFormComponentImpl;
187188
}
189+
190+
@Test
191+
public void testGetDorContainer() {
192+
Resource resource = Mockito.mock(Resource.class);
193+
AbstractFormComponentImpl abstractFormComponentImpl = new AbstractFormComponentImpl();
194+
Utils.setInternalState(abstractFormComponentImpl, "resource", resource);
195+
Utils.setInternalState(abstractFormComponentImpl, "channel", "print");
196+
197+
Resource dorContainerResource = Mockito.mock(Resource.class);
198+
Mockito.doReturn(dorContainerResource).when(resource).getChild("fd:dorContainer");
199+
200+
DorContainer dorContainerMock = Mockito.mock(DorContainer.class);
201+
Mockito.doReturn(dorContainerMock).when(dorContainerResource).adaptTo(DorContainer.class);
202+
203+
assertThrows(java.lang.IllegalArgumentException.class, () -> abstractFormComponentImpl.getDorContainer());
204+
205+
}
188206
}

0 commit comments

Comments
 (0)