Search in sources :

Example 1 with StringInternerImpl

use of org.apache.tapestry5.commons.internal.services.StringInternerImpl in project tapestry-5 by apache.

the class BindingFactoryTest method translate_binding.

@Test
public void translate_binding() {
    FieldTranslator translator = mockFieldTranslator();
    FieldTranslatorSource source = newMock(FieldTranslatorSource.class);
    ComponentResources resources = mockComponentResources();
    Location l = mockLocation();
    String description = "foo bar";
    String expression = "mock";
    expect(source.createTranslator(resources, expression)).andReturn(translator);
    replay();
    BindingFactory factory = new TranslateBindingFactory(source, new StringInternerImpl());
    Binding binding = factory.newBinding(description, resources, resources, expression, l);
    assertSame(binding.get(), translator);
    assertSame(InternalUtils.locationOf(binding), l);
    verify();
}
Also used : Binding(org.apache.tapestry5.Binding) StringInternerImpl(org.apache.tapestry5.commons.internal.services.StringInternerImpl) FieldTranslatorSource(org.apache.tapestry5.services.FieldTranslatorSource) FieldTranslator(org.apache.tapestry5.FieldTranslator) ComponentResources(org.apache.tapestry5.ComponentResources) Location(org.apache.tapestry5.commons.Location) BindingFactory(org.apache.tapestry5.services.BindingFactory) Test(org.testng.annotations.Test)

Aggregations

Binding (org.apache.tapestry5.Binding)1 ComponentResources (org.apache.tapestry5.ComponentResources)1 FieldTranslator (org.apache.tapestry5.FieldTranslator)1 Location (org.apache.tapestry5.commons.Location)1 StringInternerImpl (org.apache.tapestry5.commons.internal.services.StringInternerImpl)1 BindingFactory (org.apache.tapestry5.services.BindingFactory)1 FieldTranslatorSource (org.apache.tapestry5.services.FieldTranslatorSource)1 Test (org.testng.annotations.Test)1