### Question:
SectionHibernateDao extends GenericDao<Section> implements SectionDao { @Override public long getCountAvailableBranches(JCUser user, List<Branch> branches) { return getAvailableBranchIds(user, branches).size(); } SectionHibernateDao(SessionFactory sessionFactory); @Override @SuppressWarnings("unchecked") List<Section> getAll(); @Override List<Long> getAvailableBranchIds(JCUser user, List<Branch> branches); @Override long getCountAvailableBranches(JCUser user, List<Branch> branches);  }### Answer:
@Test public void testGetCountAvailableBranches() { JCUser user = ObjectsFactory.getDefaultUser(); assertTrue(dao.getCountAvailableBranches(user, new ArrayList<org.jtalks.common.model.entity.Branch>()) == 0); user.setGroups(new ArrayList<Group>()); List<Branch> branches = ObjectsFactory.getDefaultBranchList(); assertTrue(dao.getCountAvailableBranches(user, new ArrayList<org.jtalks.common.model.entity.Branch>(branches)) == 0); List<Group> groups = ObjectsFactory.getDefaultGroupList(); user.setGroups(groups); assertTrue(dao.getCountAvailableBranches(user, new ArrayList<org.jtalks.common.model.entity.Branch>(branches)) == 0); assertTrue(dao.getCountAvailableBranches(new AnonymousUser(), new ArrayList<org.jtalks.common.model.entity.Branch>(branches)) == 0); }