final ServiceFacade mockedFacade = Mockito.mock(ServiceFacade.class);
getSession().put(BusinessServiceProxy.SERVICE_FACADE, mockedFacade);
final BranchDAO mockBranchDAO = mock(BranchDAO.class);
final EntryDAO mockEntryDAO = mock(EntryDAO.class);
final UserDAO mockUserDAO = mock(UserDAO.class);
final ConfigItemDAO mockConfigDAO = mock(ConfigItemDAO.class);
when(daoFacade.getConfigItemDAO()).thenReturn(mockConfigDAO);
when(mockConfigDAO.readAll()).thenReturn(new ArrayList<ConfigItem>());
when(daoFacade.getBranchDAO()).thenReturn(mockBranchDAO);
testRootBranch = new Branch(Constant.ROOT_NAME, null); //mock(Branch.class);
testRootBranch.setBranchId(Constant.ROOT_ID);
when(mockBranchDAO.read(Constant.ROOT_ID)).thenReturn(testRootBranch);
/*
* when(TEST_ROOT_BRANCH.getBranchId()).thenReturn(Constant.ROOT_ID);
* when(TEST_ROOT_BRANCH.getName()).thenReturn(Constant.ROOT_NAME);
*/
when(daoFacade.getEntryDAO()).thenReturn(mockEntryDAO);
when(daoFacade.getUserDAO()).thenReturn(mockUserDAO);
when(mockUserDAO.readByUsername(eq(JournalTestCommon.TEST_USERNAME))).thenReturn(testUser);
try {
testInstance = getTestInstanceClass().newInstance();
} catch (final Exception e) {
logger.error(e.getMessage(), e);