Search in sources :

Example 6 with FragmentTemplate

use of com.adobe.cq.dam.cfm.FragmentTemplate in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class ContentFragmentUtilsTest method getTypeWhenResourceIsNull.

@Test
public void getTypeWhenResourceIsNull() {
    // GIVEN
    FragmentTemplate fragmentTemplate = Mockito.mock(FragmentTemplate.class);
    ContentFragment contentFragment = Mockito.mock(ContentFragment.class);
    Mockito.when(contentFragment.getTemplate()).thenReturn(fragmentTemplate);
    Mockito.when(contentFragment.getName()).thenReturn("foobar");
    // WHEN
    String type = ContentFragmentUtils.getType(contentFragment);
    // THEN
    Assertions.assertEquals(type, "foobar");
}
Also used : ContentFragment(com.adobe.cq.dam.cfm.ContentFragment) FragmentTemplate(com.adobe.cq.dam.cfm.FragmentTemplate) Test(org.junit.jupiter.api.Test)

Aggregations

FragmentTemplate (com.adobe.cq.dam.cfm.FragmentTemplate)6 ContentFragment (com.adobe.cq.dam.cfm.ContentFragment)5 Resource (org.apache.sling.api.resource.Resource)5 Test (org.junit.jupiter.api.Test)4 ValueMap (org.apache.sling.api.resource.ValueMap)2 ContentElement (com.adobe.cq.dam.cfm.ContentElement)1 ContentVariation (com.adobe.cq.dam.cfm.ContentVariation)1 VariationDef (com.adobe.cq.dam.cfm.VariationDef)1 LinkedList (java.util.LinkedList)1 Nullable (javax.annotation.Nullable)1 MockValueMap (org.apache.sling.testing.resourceresolver.MockValueMap)1