@Test public void getForumsByUserId() { User user = new User(); user.setPassword("1"); user.setEmail("a"); user.setRegistrationDate(new Date()); persistance.putUser(user); Site site = new Site(); site.getSitePaymentSettings().setUserId(-1); site.setSubDomain("$"); site.getThemeId().setTemplateDirectory("f"); site.getThemeId().setThemeCss("G"); site.setTitle("F"); persistance.putSite(site); UserOnSiteRight userOnUserRight = new UserOnSiteRight(); userOnUserRight.setActive(true); userOnUserRight.setSiteAccessType(SiteAccessLevel.ADMINISTRATOR); user.addUserOnSiteRight(userOnUserRight); site.addUserOnSiteRight(userOnUserRight); persistance.putUserOnSiteRight(userOnUserRight); DraftForum forum = new DraftForum(); forum.setSiteId(site.getSiteId()); forum.setName("name"); persistance.putItem(forum); List<DraftItem> userForums = persistance.getDraftItemsByUserId(user.getUserId(), ItemType.FORUM); Assert.assertEquals(forum, userForums.get(0)); }
@Test public void getForumsByUserIdWithoutActive() { User user = new User(); user.setPassword("1"); user.setEmail("a"); user.setRegistrationDate(new Date()); persistance.putUser(user); Site site = new Site(); site.getSitePaymentSettings().setUserId(-1); site.setSubDomain("$"); site.getThemeId().setTemplateDirectory("f"); site.getThemeId().setThemeCss("G"); site.setTitle("F"); persistance.putSite(site); DraftForum forum = new DraftForum(); forum.setSiteId(site.getSiteId()); forum.setName("name"); persistance.putItem(forum); List<DraftItem> userForums = persistance.getDraftItemsByUserId(user.getUserId(), ItemType.FORUM); Assert.assertEquals(0, userForums.size()); }