InformationElementServiceImpl implements InformationElementService { @Override public InformationElement getInformationElement(String family, int informationElementId) { if (isNeedToSync(family)) { synchronized (this) { if (isNeedToSync(family)) { m_ieMappingCacheService.syncIEMappingCache(family); } } } return m_ieCache.getInformationElement(family, informationElementId); } InformationElementServiceImpl(InformationElementCache ieCache); @Override InformationElement getInformationElement(String family, int informationElementId); @Override InformationElement getInformationElement(long enterpriseNumber, String informationElementName); @Override boolean isIECacheAvailable(); @Override void loadInformationElementMapping(String family, File file); @Override boolean removeInformationElementMapping(String deviceFamily); @Override void setIeMappingCacheService(IEMappingCacheService ieMappingCacheService);  }
@Test public void testGetInformationElement() { String informationElementName = "/sys:system/sys:hostname"; InformationElement expected = new InformationElement(); when(m_cache.getInformationElement(3729L, informationElementName)).thenReturn(expected); m_informationElementService = new InformationElementServiceImpl(m_cache); InformationElement actual = m_informationElementService.getInformationElement(3729L, informationElementName); verify(m_cache).getInformationElement(3729L, informationElementName); assertEquals(expected, actual); }