PortalImpl implements Portal { @Override public Site getSite(SiteId siteId) { Parameters.requireNonNull(siteId, "siteId"); SiteKey siteKey = Util.from(siteId); try { PortalConfig portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName()); return (portalConfig == null) ? null : new SiteImpl(portalConfig); } catch (Throwable e) { throw new ApiException("Failed to get site", e); } } PortalImpl(DataStorage dataStorage, PageService pageService, NavigationService navigationService,
                      DescriptionService descriptionService, ResourceBundleManager bundleManager, Authenticator authenticator,
                      IdentityRegistry identityRegistry, UserACL acl, UserPortalConfigService userPortalConfigService,
                      OAuthProviderAccessor oauthProviderAccessor); @Override Site getSite(SiteId siteId); @Override Site createSite(SiteId siteId); @Override Site createSite(SiteId siteId, String templateName); @Override List<Site> findSites(SiteQuery query); @Override void saveSite(Site site); @Override boolean removeSite(SiteId siteId); @Override Navigation getNavigation(SiteId siteId); @Override PageBuilder newPageBuilder(); @Override ApplicationRegistry getApplicationRegistry(); @Override Page getPage(PageId pageId); List<ContainerItem> getPageRootContainer(PageContext pageContext); @Override Page createPage(PageId pageId); @Override List<Page> findPages(PageQuery query); @Override void savePage(Page page); @Override boolean removePage(PageId pageId); @Override boolean hasPermission(User user, Permission permission); @Override OAuthProvider getOAuthProvider(String oauthProviderKey);  }
@Test public void getSite() { createSite(defaultSiteId); assertNotNull(portal.getSite(new SiteId("classic"))); }
@Test public void getSite_NonExisting() { assertNull(portal.getSite(new SiteId("nosuch"))); }
@Test(expected = IllegalArgumentException.class) public void getSite_NullSiteId() { portal.getSite(null); }