### Question:
BranchHibernateDao extends GenericDao<Branch> implements BranchDao { @SuppressWarnings("unchecked") @Override public List<Branch> getAllBranches() { List<Branch> branches = session() .getNamedQuery("getAllBranches") .list(); return branches; } BranchHibernateDao(SessionFactory sessionFactory); @SuppressWarnings("unchecked") @Override List<Branch> getAllBranches(); @Override int getCountPostsInBranch(Branch branch); @Override Collection<JCUser> getAllowedSubscribers(SubscriptionAwareEntity entity);  }### Answer:
@Test public void shouldReturnNoBranchesWhenDbIsEmpty() { Section emptySection = ObjectsFactory.getDefaultSection(); session.save(emptySection); List<Branch> selectedBranches = dao.getAllBranches(); assertTrue(selectedBranches.isEmpty()); }
@Test public void testGetAllBranches() { int sectionSize = 5; List<Branch> branchesOfFirstSection = createAndSaveBranchList(sectionSize, 1); List<Branch> branchesOfSecondSection = createAndSaveBranchList(sectionSize, 0); List<Branch> createdBranches = new ArrayList<>(branchesOfSecondSection); createdBranches.addAll(branchesOfFirstSection); List<Branch> selectedBranches = dao.getAllBranches(); assertEquals(createdBranches, selectedBranches); }