@Test public void getLockInfo() { ContentManipulationLockService tested = getTested(); Assert.assertNull(tested.getLockInfo()); Mockito.when(tested.configService.get(ContentManipulationLockService.CFGFILE_NAME)) .thenReturn(new HashMap<String, Object>()); Assert.assertNull(tested.getLockInfo()); { Mockito.when(tested.configService.get(ContentManipulationLockService.CFGFILE_NAME)) .thenReturn(createCfgFileAll()); List<String> li = tested.getLockInfo(); Assert.assertNotNull(li); Assert.assertEquals(1, li.size()); Assert.assertTrue(li.contains(ContentManipulationLockService.API_ID_ALL)); } { Mockito.when(tested.configService.get(ContentManipulationLockService.CFGFILE_NAME)) .thenReturn(createCfgFileP1P2()); List<String> li = tested.getLockInfo(); Assert.assertNotNull(li); Assert.assertEquals(2, li.size()); Assert.assertTrue(li.contains(PROVIDER_1)); Assert.assertTrue(li.contains(PROVIDER_2)); } }