Package org.libreplan.business.qualityforms.entities

Examples of org.libreplan.business.qualityforms.entities.QualityForm


        return getFromDB(qualityForm.getId());
    }

    private QualityForm getFromDB(Long id) {
        try {
            QualityForm result = qualityFormDAO.find(id);
            reattachQualityFormItems(result);
            return result;
        } catch (InstanceNotFoundException e) {
            throw new RuntimeException(e);
        }
View Full Code Here


    }

    @Test
    @Transactional
    public void testSaveQualityForm() {
        QualityForm qualityForm = createValidQualityForm();
        qualityFormDAO.save(qualityForm);
        assertTrue(qualityForm.getId() != null);
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testRemoveQualityForm() throws InstanceNotFoundException {
        QualityForm qualityForm = createValidQualityForm();
        qualityFormDAO.save(qualityForm);
        qualityFormDAO.remove(qualityForm.getId());
        assertFalse(qualityFormDAO.exists(qualityForm.getId()));
    }
View Full Code Here

    @Test
    @Transactional
    public void testListQualityForm() {
        int previous = qualityFormDAO.list(QualityForm.class).size();
        QualityForm qualityForm = createValidQualityForm();
        qualityFormDAO.save(qualityForm);
        List<QualityForm> list = qualityFormDAO.list(QualityForm.class);
        assertEquals(previous + 1, list.size());
    }
View Full Code Here

    }

    @Test
    @Transactional
    public void testSaveQualityFormItems() {
        QualityForm qualityForm = createValidQualityForm();
        QualityFormItem qualityFormItem = createValidQualityFormItem();
        qualityForm.addQualityFormItemOnTop(qualityFormItem);
        qualityFormDAO.save(qualityForm);

        assertTrue(qualityForm.getId() != null);
        assertEquals(1, qualityForm.getQualityFormItems().size());
    }
View Full Code Here

    @Test
    @Transactional
    public void testSaveAndRemoveQualityFormItem()
            throws InstanceNotFoundException {
        QualityForm qualityForm = createValidQualityForm();
        QualityFormItem qualityFormItem = createValidQualityFormItem();
        qualityForm.addQualityFormItemOnTop(qualityFormItem);
        qualityFormDAO.save(qualityForm);

        assertTrue(qualityForm.getId() != null);
        assertEquals(1, qualityForm.getQualityFormItems().size());

        qualityForm.removeQualityFormItem(qualityFormItem);
        assertEquals(0, qualityForm.getQualityFormItems().size());
    }
View Full Code Here

    @AssertTrue(message = "a quality form cannot be assigned twice to the same task")
    public boolean isUniqueQualityFormConstraint() {
        Set<QualityForm> qualityForms = new HashSet<QualityForm>();
        for (TaskQualityForm each : taskQualityForms) {
            QualityForm qualityForm = each.getQualityForm();
            if (qualityForms.contains(qualityForm)) {
                return false;
            }
            qualityForms.add(qualityForm);
        }
View Full Code Here

    @Autowired
    IQualityFormDAO qualityFormDAO;

    public QualityForm createValidQualityForm() {
        QualityForm qualityForm = QualityForm.create(UUID.randomUUID()
                .toString(), UUID.randomUUID().toString());
        return qualityForm;
    }
View Full Code Here

    IQualityFormDAO qualityFormDAO;

    @Test
    @Transactional
    public void checkInvalidNameQualityForm() throws ValidationException {
        QualityForm qualityForm = createValidQualityForm();
        qualityForm.setName("");
        try {
            qualityFormDAO.save(qualityForm);
            fail("It should throw an exception");
        } catch (ValidationException e) {
            // It should throw an exception
        }

        qualityForm.setName(null);
        try {
            qualityFormDAO.save(qualityForm);
            fail("It should throw an exception");
        } catch (ValidationException e) {
            // It should throw an exception
View Full Code Here

    }

    @Test
    @Transactional
    public void checkInvalidQualityFormType() throws ValidationException {
        QualityForm qualityForm = createValidQualityForm();
        try {
            qualityForm.setQualityFormType(null);
            qualityFormDAO.save(qualityForm);
            fail("It should throw an exception");
        } catch (ValidationException e) {
            // It should throw an exception
        } catch (IllegalArgumentException e) {
View Full Code Here

TOP

Related Classes of org.libreplan.business.qualityforms.entities.QualityForm

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.