Package org.codehaus.preon.el

Examples of org.codehaus.preon.el.Document


    }

    @Test
    public void testSelectNonExistingProperty() {
        StringBuilder builder = new StringBuilder();
        Document document = new StringBuilderDocument(builder);
        String propertyName = "pi";
        Reference selected1 = createMock(Reference.class);
        Reference selected2 = createMock(Reference.class);
        expect(reference1.getType()).andReturn(String.class);
        expect(reference2.getType()).andReturn(String.class);
View Full Code Here


    }

    @Test
    public void testNarrow() {
        StringBuilder builder = new StringBuilder();
        Document document = new StringBuilderDocument(builder);
        String propertyName = "pi";
        expect(reference1.narrow(String.class)).andReturn(reference1);
        expect(reference2.narrow(String.class)).andReturn(reference2);
        expect(reference1.getType()).andReturn(String.class).times(2);
        expect(reference2.getType()).andReturn(String.class).times(2);
View Full Code Here

    }

    @Test
    public void testNarrowPartly() {
        StringBuilder builder = new StringBuilder();
        Document document = new StringBuilderDocument(builder);
        String propertyName = "pi";
        expect(reference1.narrow(String.class)).andReturn(reference1);
        expect(reference2.narrow(String.class)).andReturn(null);
        expect(reference1.getType()).andReturn(String.class).times(2);
        expect(reference2.getType()).andReturn(String.class).times(1);
View Full Code Here

    @Test
    public void testDocumentation() throws InvalidExpressionException {
        VariableDefinitions defs = new DataVariableDefinitions();
        VariableContext context = new VariableContext(defs);
        Reference<VariableResolver> reference = context.selectAttribute("data");
        Document document = null;

        document = new StringBuilderDocument();
        reference.document(document);
        assertEquals("the data", document.toString());

        documentProperty(reference);
        documentArrayElement(context, reference);
        documentPropertyOfArrayElement(context, reference);
    }
View Full Code Here


    private void documentArrayElement(VariableContext context,
            Reference<VariableResolver> reference)
            throws InvalidExpressionException {
        Document document;
        reference = reference.selectAttribute("datas");
        reference = reference.selectItem("1");
        document = new StringBuilderDocument();
        reference.document(document);
        assertEquals("the second element of the datas (a Data[]) of the data",
                document.toString());
    }
View Full Code Here

    }

    private void documentPropertyOfArrayElement(VariableContext context,
            Reference<VariableResolver> reference)
            throws InvalidExpressionException {
        Document document;
        reference = reference.selectAttribute("datas");
        reference = reference.selectItem("1");
        reference = reference.selectAttribute("number");
        document = new StringBuilderDocument();
        reference.document(document);
        assertEquals(
                "the number (a int) of the second element of the datas (a Data[]) of the data",
                document.toString());
    }
View Full Code Here

                "the number (a int) of the second element of the datas (a Data[]) of the data",
                document.toString());
    }

    private void documentProperty(Reference<VariableResolver> reference) {
        Document document;
        reference = reference.selectAttribute("number");
        document = new StringBuilderDocument();
        reference.document(document);
        assertEquals("the number (a int) of the data", document.toString());
    }
View Full Code Here

            para.text(" value preceeding the actual encoded value.");
            for (int i = 0; i < codecs.size(); i++) {
                Codec<?> codec = codecs.get(i);
                Expression<Integer, Resolver> expression = expressions.get(i);
                para.text(" If ");
                expression.document(new Document() {

                    public Document detail(String text) {
                        para.text(text);
                        return this;
                    }
View Full Code Here

        int size = ((Number) (this.sizeExpr.eval(resolver))).intValue();
        Object result = type.decode(buffer, size, byteOrder);
        if (matchExpr != null) {
            if (!matchExpr.eval(resolver).equals(Converters.toInt(result))) {
                StringBuilder stringBuilder = new StringBuilder();
                Document document = new StringBuilderDocument(stringBuilder);
                if (matchExpr.isParameterized()) {
                    stringBuilder.append("Expected different value than "
                            + result);
                } else {
                    stringBuilder.append("Expected ");
View Full Code Here

TOP

Related Classes of org.codehaus.preon.el.Document

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.