Package hu.sztaki.ilab.longneck.process.constraint

Examples of hu.sztaki.ilab.longneck.process.constraint.IsNotLongerConstraint


    }

    @Test
    public void testNegativeValue() throws BlockError {
        try {
            IsNotLongerConstraint islonger = new IsNotLongerConstraint();

            islonger.setValue(-56);

            // Prepare record
            RecordImpl r = new RecordImpl();
            r.add(new Field("a", ""));
            r.add(new Field("b", "bbbbb"));
            r.add(new Field("c", "cccc"));
            r.add(new Field("d", "ddd"));

            List<String> applyTo = new ArrayList<String>(3);
            applyTo.add("a");

            islonger.setApplyTo(applyTo);
            Assert.assertTrue(islonger.check(r, new VariableSpace()).isPassed());
        } catch (Exception ex) {
            Assert.fail("Method must not raise exception.");
        }
    }
View Full Code Here


*/
public class IsLongerTest extends AbstractBlockTest {

    @Test
    public void testUnmarshal() throws SAXException, IOException, MarshalException, ValidationException, Exception {
        IsNotLongerConstraint islonger = new IsNotLongerConstraint();
       
        List<String> applyTo = new ArrayList<String>(3);
        applyTo.add("a");
        applyTo.add("b");
        applyTo.add("c");
       
        islonger.setApplyTo(applyTo);
        islonger.setValue(4);
       
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/islonger.xml"));
       
        // Unmarshal document
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
       
        Assert.assertTrue((((If) process.getBlocks().get(0)).getCondition().getConstraints().get(0) instanceof IsNotLongerConstraint));       
        IsNotLongerConstraint testedislonger = (IsNotLongerConstraint) ((If) process.getBlocks().get(0)).getCondition().getConstraints().get(0);
       
        Assert.assertEquals(applyTo, testedislonger.getApplyTo());
        Assert.assertEquals(islonger.getValue(), testedislonger.getValue());
    }
View Full Code Here

        Assert.assertEquals(islonger.getValue(), testedislonger.getValue());
    }
   
    @Test
    public void testCut() throws BlockError {
        IsNotLongerConstraint islonger = new IsNotLongerConstraint();

        islonger.setValue(4);

        // Prepare record
        RecordImpl r = new RecordImpl();
        r.add(new Field("a", "aaaaaa"));
        r.add(new Field("b", "bbbbb"));
        r.add(new Field("c", "cccc"));
        r.add(new Field("d", "ddd"));

        List<String> applyTo = new ArrayList<String>(3);
        applyTo.add("a");

        islonger.setApplyTo(applyTo);
        Assert.assertFalse(islonger.check(r, new VariableSpace()).isPassed());

        applyTo = new ArrayList<String>(3);
        applyTo.add("b");

        islonger.setApplyTo(applyTo);
        Assert.assertFalse(islonger.check(r, new VariableSpace()).isPassed());

        applyTo = new ArrayList<String>(3);
        applyTo.add("c");

        islonger.setApplyTo(applyTo);
        Assert.assertTrue(islonger.check(r, new VariableSpace()).isPassed());

        applyTo = new ArrayList<String>(3);
        applyTo.add("d");

        islonger.setApplyTo(applyTo);
        Assert.assertTrue(islonger.check(r, new VariableSpace()).isPassed());

        applyTo = new ArrayList<String>(3);
        applyTo.add("d");
        applyTo.add("a");

        islonger.setApplyTo(applyTo);
        Assert.assertFalse(islonger.check(r, new VariableSpace()).isPassed());
    }
View Full Code Here

    }

    @Test
    public void testNonexistingApplyToIdentifier() throws BlockError {
        try {
            IsNotLongerConstraint islonger = new IsNotLongerConstraint();

            islonger.setValue(4);

            // Prepare record
            RecordImpl r = new RecordImpl();
            r.add(new Field("a", "aaaaaa"));
            r.add(new Field("b", "bbbbb"));
            r.add(new Field("c", "cccc"));
            r.add(new Field("d", "ddd"));

            List<String> applyTo = new ArrayList<String>(3);
            applyTo.add("d");
            applyTo.add("i");

            islonger.setApplyTo(applyTo);
            Assert.assertTrue(islonger.check(r, new VariableSpace()).isPassed());
        } catch (Exception ex) {
            Assert.fail("Method must not raise exception.");
        }
    }
View Full Code Here

TOP

Related Classes of hu.sztaki.ilab.longneck.process.constraint.IsNotLongerConstraint

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.