Package org.apache.tapestry.ioc

Examples of org.apache.tapestry.ioc.Location


    @Test
    public void method_call_as_terminal()
    {
        TargetBean bean = new TargetBean();
        ComponentResources resources = newComponentResources(bean);
        Location l = mockLocation();

        replay();

        Binding binding = _factory.newBinding(
                "test binding",
View Full Code Here


    }

    @Test
    public void location_of_location()
    {
        Location l = mockLocation();

        replay();

        assertSame(l, InternalUtils.locationOf(l));
View Full Code Here

    }

    @Test
    public void location_of_locatable()
    {
        Location l = mockLocation();
        Locatable locatable = newMock(Locatable.class);

        expect(locatable.getLocation()).andReturn(l);

        replay();
View Full Code Here

    {

        int line = _random.nextInt();
        int column = _random.nextInt();

        Location l = new LocationImpl(_resource, line, column);

        assertSame(l.getResource(), _resource);
        assertEquals(l.getLine(), line);
        assertEquals(l.getColumn(), column);

        assertEquals(l.toString(), String.format("%s, line %d, column %d", _resource, line, column));
    }
View Full Code Here

    @Test
    public void unknown_column()
    {
        int line = _random.nextInt();

        Location l = new LocationImpl(_resource, line);

        assertSame(l.getResource(), _resource);
        assertEquals(l.getLine(), line);
        assertEquals(l.getColumn(), -1);

        assertEquals(l.toString(), String.format("%s, line %d", _resource, line));
    }
View Full Code Here

    }

    @Test
    public void unknown_line_and_column()
    {
        Location l = new LocationImpl(_resource);

        assertSame(l.getResource(), _resource);
        assertEquals(l.getLine(), -1);
        assertEquals(l.getColumn(), -1);

        assertEquals(l.toString(), _resource.toString());
    }
View Full Code Here

    }

    @Test
    public void equality()
    {
        Location l1 = new LocationImpl(_resource, 22, 7);
        Location l2 = new LocationImpl(_resource, 22, 7);
        Location l3 = new LocationImpl(null, 22, 7);
        Location l4 = new LocationImpl(_resource, 99, 7);
        Location l5 = new LocationImpl(_resource, 22, 99);
        Location l6 = new LocationImpl(new ClasspathResource("/baz/Biff.txt"), 22, 7);

        assertEquals(l1, l1);
        assertFalse(l1.equals(null));

        assertEquals(l1, l2);
        assertEquals(l2.hashCode(), l1.hashCode());

        assertFalse(l3.equals(l1));
        assertFalse(l3.hashCode() == l1.hashCode());

        assertFalse(l4.equals(l1));
        assertFalse(l4.hashCode() == l1.hashCode());

        assertFalse(l5.equals(l1));
        assertFalse(l5.hashCode() == l1.hashCode());

        assertFalse(l6.equals(l1));
        assertFalse(l6.hashCode() == l1.hashCode());
    }
View Full Code Here

    }

    @Test
    public void exception_properties()
    {
        Location l = mockLocation();

        replay();

        Throwable t = new TapestryException("Message", l, null);
View Full Code Here

    }

    @Test
    public void middle_exception_retained_due_to_extra_property()
    {
        Location l = mockLocation();

        replay();

        Throwable inner = new RuntimeException("Inner");
        Throwable middle = new TapestryException("Middle", l, inner);
View Full Code Here

        Method m = target.getMethod("fred");

        // 21 is the line containing the close brace

        Location l = factory.getMethodLocation(m);
        assertEquals(
                l.toString(),
                "org.apache.tapestry.ioc.internal.services.LineNumberBean.fred() (at LineNumberBean.java:25)");
        assertEquals(l.getLine(), 25);

        m = target.getMethod("betty", String.class, int.class);

        // 25 is the line of the return statement
View Full Code Here

TOP

Related Classes of org.apache.tapestry.ioc.Location

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.