Hi All,
Can any one help me please how to mock for junit test case below factory class.
private ResourceResolverFactory resourceResolverFactory;
Thanks,
Venkatesham G
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Venkatesham,
Something like this :)
import com.day.cq.dam.api.Asset; import org.apache.sling.api.resource.ResourceResolverFactory; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; /** * Created by Peter.Puzanovs on 17/11/2015. */ @RunWith(MockitoJUnitRunner.class) public class OneHundreadPercentCoverage { @Mock private ResourceResolverFactory resourceResolverFactory; @Test public void test() { Assert.assertNotNull(resourceResolverFactory); } }
Thanks,
Peter
Views
Replies
Total Likes
Hi Venkatesham,
Something like this :)
import com.day.cq.dam.api.Asset; import org.apache.sling.api.resource.ResourceResolverFactory; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; /** * Created by Peter.Puzanovs on 17/11/2015. */ @RunWith(MockitoJUnitRunner.class) public class OneHundreadPercentCoverage { @Mock private ResourceResolverFactory resourceResolverFactory; @Test public void test() { Assert.assertNotNull(resourceResolverFactory); } }
Thanks,
Peter
Views
Replies
Total Likes