Examples of Branch


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

     * Case 3: Non existing branch id (update).
     */
    @Test(expected = JournalException.class)
    public void testSaveBranch3()
    {
        final Branch branch2 = new Branch();
        branch2.setBranchId(ID_NON_EXISTENT);
        branchDAO.save(branch2);
        Assert.fail("Case 2: Non existing branch id (update).");
    }
View Full Code Here

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

     */
    @Test
    public void testSaveBranch4()
    {
        final int count3 = super.getRecordCount(super.getBranchTableName());
        final Branch root3 = branchDAO.read(Constant.ROOT_ID);
        final Branch branch3 = new Branch("Test Insert 3", root3);
        try {
            branchDAO.save(branch3);
            Assert.assertEquals("Case 4.1: Parent not null: Count increase.", count3 + 1,
                    super.getRecordCount(super.getBranchTableName()));
            Assert.assertNotNull("Case 4.2: Parent not null: Read inserted.", branchDAO.read(branch3.getBranchId()));
            Assert.assertNotSame("Case 4.3: Parent not null: Branch ID set.", 0, branch3.getBranchId());
        } catch (final JournalException e) {
            getCommon().failUnexpectedException(e);
        }
    }
View Full Code Here

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

     */
    @Test
    public void testSaveBranch5()
    {
        final int count4 = super.getRecordCount(super.getBranchTableName());
        final Branch branch4 = new Branch("Test Insert 4", null);
        try {
            branchDAO.save(branch4);
            Assert.assertEquals("Case 5.1: Insert with null parent, count increase.", count4 + 1,
                    super.getRecordCount(super.getBranchTableName()));
            Assert.assertNotNull("Case 5.2: Insert with null parent, read inserted.",
                    branchDAO.read(branch4.getBranchId()));
            Assert.assertNotSame("Case 5.3: Insert with null parent, Branch ID generated.", 0, branch4.getBranchId());
        } catch (final JournalException e) {
            getCommon().failUnexpectedException(e);
        }
    }
View Full Code Here

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

     */
    @Test
    public void testSaveBranch6()
    {
        final int count5 = super.getRecordCount(super.getBranchTableName());
        final Branch branch5 = branchDAO.read(ID_1ST_TST_BRANCH);
        final String branchName5 = branch5.getName();
        Assert.assertFalse("Case 6.1: Update, Branch equality.", branchName5.equals(TEST_NEW_BRANCHNAME));
        branch5.setName(TEST_NEW_BRANCHNAME);
        try {
            branchDAO.save(branch5);
            Assert.assertEquals("Case 6.2: Update, increase record count.", count5,
                    super.getRecordCount(super.getBranchTableName()));
            final Branch saved5 = branchDAO.read(ID_1ST_TST_BRANCH);
            Assert.assertEquals("Case 6.3: Update, Branch equality.", TEST_NEW_BRANCHNAME, saved5.getName());
        } catch (final JournalException e) {
            getCommon().failUnexpectedException(e);
        }
    }
View Full Code Here

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

    {
        final EntryDAO mockedEntryDAO = getDaoFacade().getEntryDAO();
        final BranchDAO mockedBranchDAO = getDaoFacade().getBranchDAO();

        final long branchId = 1L;
        final Branch testParentBranch = new Branch("Test Parent", null);
        when(mockedBranchDAO.read(branchId)).thenReturn(testParentBranch);

        final String testTitle = "Test Title";
        final String testDesc = "Test Description";
View Full Code Here

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

        when(mockedEntryDAO.read(entryId)).thenReturn(testEntry);

        final long newBranchId = 666L;
        final String newTitle = "New Title";
        final String newDescription = "New Description";
        final Branch newParentBranch = new Branch("Test Parent", null);
        newParentBranch.setBranchId(newBranchId);
        when(mockedBranchDAO.read(newBranchId)).thenReturn(newParentBranch);

        final ArgumentCaptor<Entry> argument = ArgumentCaptor.forClass(Entry.class);

        try {
View Full Code Here

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

     */
    @Test(expected = JournalException.class)
    public void testDeleteAll3()
    {
        //final int origCount = super.getRecordCount(super.branchTableName);
        final Branch branch2 = branchDAO.read(40002);
        final List<Branch> list2 = new ArrayList<Branch>();
        list2.add(branch2);
        branchDAO.deleteAll(list2);
        Assert.fail("Case 3: Foreignkey constrained.");
        //VERIFY: Assert.assertEquals(test[2], origCount, super.getRecordCount(super.branchTableName));
View Full Code Here

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

    /** Case 4: Null title. */
    @Test(expected = IllegalArgumentException.class)
    public final void testSaveEntry4()
    {
        final BranchDAO mockedBranchDAO = getDaoFacade().getBranchDAO();
        when(mockedBranchDAO.read(anyInt())).thenReturn(new Branch());
        try {
            entryServiceImpl.saveEntry(super.getSession(), 0, 0, null, null);
            fail("Case 4: Null title.");
        } catch (final JournalException e) {
            getCommon().failUnexpectedException(e);
View Full Code Here

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

     */
    @Test
    public final void testMoveEntry3()
    {
        final long newBranchId = 40002;
        final Branch newBranch = new Branch("new branch", null);
        newBranch.setBranchId(newBranchId);

        final long oldBranchId = 40001;
        final Branch oldBranch = new Branch("old branch", null);
        oldBranch.setBranchId(oldBranchId);

        final long entryId = 666L;
        final String title = "title";
        final String desc = "desc";
        final Entry entry = new Entry(title, desc, oldBranch);
View Full Code Here

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

        spyInstance = getSpyInstance();

        final BranchDAO branchDAO = getDaoFacade().getBranchDAO();
        final EntryDAO entryDAO = getDaoFacade().getEntryDAO();

        testBranch1 = new Branch("RootBranch1", getTestRootBranch());
        testBranch1.setBranchId(TEST_ID_RTBRANCH1);

        testSubBranch1 = new Branch("SubBranch1", testBranch1);
        testSubBranch1.setBranchId(TEST_ID_SUBBRANCH1);

        final Entry entry1 = new Entry("Entry Title 1", "Entry Desc 1", testBranch1);
        final Entry entry2 = new Entry("Entry Title 2", "Entry Desc 2", testBranch1);
        final Entry entry3 = new Entry("Entry Title 3", "Entry Desc 3", testSubBranch1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.