Package org.libreplan.business.costcategories.entities

Examples of org.libreplan.business.costcategories.entities.ResourcesCostCategoryAssignment


    }

    @Test
    @Transactional
    public void testRemoveResourcesCostCategoryAssignment() throws InstanceNotFoundException {
        ResourcesCostCategoryAssignment assignment = createValidResourcesCostCategoryAssignment();
        resourcesCostCategoryAssignmentDAO.save(assignment);
        resourcesCostCategoryAssignmentDAO.remove(assignment.getId());
        assertFalse(resourcesCostCategoryAssignmentDAO.exists(assignment.getId()));
    }
View Full Code Here


    @Test
    @Transactional
    public void testListResourcesCostCategoryAssignments() {
        int previous = resourcesCostCategoryAssignmentDAO.list(ResourcesCostCategoryAssignment.class).size();
        ResourcesCostCategoryAssignment assignment = createValidResourcesCostCategoryAssignment();
        resourcesCostCategoryAssignmentDAO.save(assignment);
        List<ResourcesCostCategoryAssignment> list = resourcesCostCategoryAssignmentDAO.list(ResourcesCostCategoryAssignment.class);
        assertEquals(previous + 1, list.size());
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testNavigateRelations() {
        ResourcesCostCategoryAssignment assignment = createValidResourcesCostCategoryAssignment();
        resourcesCostCategoryAssignmentDAO.save(assignment);
        Resource resource = assignment.getResource();

        assertTrue(costCategoryDAO.list(CostCategory.class).contains(assignment.getCostCategory()));
        assertTrue(resource.getResourcesCostCategoryAssignments().contains(assignment));

        assignment.setResource(null);
        assertFalse(resource.getResourcesCostCategoryAssignments().contains(assignment));
    }
View Full Code Here

    }

    @Test(expected=ValidationException.class)
    @Transactional
    public void testPositiveTimeInterval() {
        ResourcesCostCategoryAssignment assignment = createValidResourcesCostCategoryAssignment();
        assignment.setInitDate(new LocalDate(2000,12,31));
        assignment.setEndDate(new LocalDate(2000,12,1));

        resourcesCostCategoryAssignmentDAO.save(assignment);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testGetResourcesCostCategoryAssignmentsByCostCategory() {
        ResourcesCostCategoryAssignment assignment1 = createValidResourcesCostCategoryAssignment();
        ResourcesCostCategoryAssignment assignment2 = createValidResourcesCostCategoryAssignment();
        resourcesCostCategoryAssignmentDAO.save(assignment1);
        resourcesCostCategoryAssignmentDAO.save(assignment2);

        assertTrue(resourcesCostCategoryAssignmentDAO.getResourcesCostCategoryAssignmentsByCostCategory(
                assignment1.getCostCategory()).contains(assignment1));
        assertFalse(resourcesCostCategoryAssignmentDAO.getResourcesCostCategoryAssignmentsByCostCategory(
                assignment1.getCostCategory()).contains(assignment2));

        assignment2.setCostCategory(assignment1.getCostCategory());
        resourcesCostCategoryAssignmentDAO.save(assignment2);
        assertTrue(resourcesCostCategoryAssignmentDAO.getResourcesCostCategoryAssignmentsByCostCategory(
                assignment1.getCostCategory()).contains(assignment2));
    }
View Full Code Here

TOP

Related Classes of org.libreplan.business.costcategories.entities.ResourcesCostCategoryAssignment

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.