Package com.philip.journal.home.bean

Examples of com.philip.journal.home.bean.Branch


        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);
 
View Full Code Here


     *                Case 3: Foreign key constraint.
     */
    @Test(expected = JournalException.class)
    public void testDeleteAllCase3()
    {
        final Branch branch2 = branchDAO.read(40002);
        final List<Branch> list2 = new ArrayList<Branch>();
        list2.add(branch2);
        branchDAO.deleteAll(list2);
        fail("Foreign key constraint test failed.");
    }
View Full Code Here

    /** Case 9: Expected matched Entity reference property. */
    @Test
    public void testReadAll0StringObject9()
    {
        final Branch branch = branchDAO.read(ID_1ST_TST_BRANCH);
        assertEquals("Case 9: Expected matched Entity reference property.", 1, testBaseSpringHibernateDAOEntryImpl
                .readAll0(ATTR_BRANCH, branch).size());
    }
View Full Code Here

    /** Case 4: Matched by parent. */
    @Test
    public void testReadAllByParent4()
    {
        final Branch parent = branchDAO.read(Constant.ROOT_ID);
        final List<Entry> byParent = testBaseSpringHibernateDAOEntryImpl.readAllByParent(ATTR_BRANCH, "parent", parent);
        assertEquals("Case 4: Matched by parent.", 2, byParent.size());
    }
View Full Code Here

        final List<Entry> byName = testBaseSpringHibernateDAOEntryImpl.readAllByParent(ATTR_BRANCH, ATTR_ENTRY_NAME,
                "Test Branch 1");
        assertEquals("4. parent byName check failed.", 1, byName.size());

        final Branch parent = branchDAO.read(Constant.ROOT_ID);
        final List<Entry> byParent = testBaseSpringHibernateDAOEntryImpl.readAllByParent(ATTR_BRANCH, "parent", parent);
        assertEquals("5. parent byParent check failed.", 2, byParent.size());
    }
View Full Code Here

    /** Case 6: Expected match on Branch entity. */
    @Test
    public void testReadObjectMapOfStringObject6()
    {
        final Map<String, Object> param = new HashMap<String, Object>();
        final Branch branch = branchDAO.read(ID_1ST_TST_BRANCH);
        param.put(ATTR_BRANCH, branch);
        assertNotNull("Case 6: Expected match on Branch entity.", testBaseSpringHibernateDAOEntryImpl.readObject(param));
    }
View Full Code Here

     *                Case 3: Foreign key constraint.
     */
    @Test(expected = JournalException.class)
    public void testDeleteAllCase3()
    {
        final Branch branch2 = branchDAO.read(40002);
        final List<Branch> list2 = new ArrayList<Branch>();
        list2.add(branch2);
        branchDAO.deleteAll(list2);
        fail("Foreign key constraint test failed.");
    }
View Full Code Here

    /** Case 2: Not null constraint. */
    @Test(expected = JournalException.class)
    public void testSaveCase2()
    {
        testBaseSpringHibernateDAOBranchImpl.save(new Branch());
    }
View Full Code Here

    /** Case 3: Update with non-existent ID. */
    @Test(expected = JournalException.class)
    public void testSaveCase3()
    {
        final Branch branch = new Branch();
        branch.setName("Test Name");
        branch.setBranchId(ID_NON_EXISTENT);
        testBaseSpringHibernateDAOBranchImpl.save(branch);
    }
View Full Code Here

    /** Case 4: Expected insert. */
    @Test
    public void testSaveCase4()
    {
        final Branch branch = new Branch();
        final int origCount = super.getRecordCount(super.getBranchTableName());
        final String branchName = TEST_TITLE;
        branch.setName(branchName);
        try {
            testBaseSpringHibernateDAOBranchImpl.save(branch);
        } catch (final JournalException e) {
            fail("Insert test failed.");
        }
        assertEquals("Record count increase failed.", origCount + 1, super.getRecordCount(super.getBranchTableName()));
        final Map<String, Object> saved = super.readBranch(branch.getBranchId());
        assertEquals("Read saved object failed.", branchName, saved.get(ATTR_ENTRY_NAME));

    }
View Full Code Here

TOP

Related Classes of com.philip.journal.home.bean.Branch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.