@Test public void shouldGetCurrentRootSiteId() throws CMException { doReturn(policyCMServer).when(target).getCmServer(); doReturn(configUtil).when(target).getConfiguration(policyCMServer); Policy topPolicy = mock(Policy.class); VersionedContentId id = mock(VersionedContentId.class); when(contentSession.getTopPolicy()).thenReturn(topPolicy); when(topPolicy.getContentId()).thenReturn(id); when(configUtil.getCurrentRootSiteId(id)).thenReturn(siteId); assertEquals(siteId, target.getCurrentRootSiteId()); }