use of org.mule.runtime.api.el.Binding in project mule by mulesoft.
the class DefaultBindingContextBuilderTestCase method addsBindings.
@Test
public void addsBindings() {
ExpressionModule module = ExpressionModule.builder(namespace).addBinding(ID, typedValue).build();
BindingContext previousContext = BindingContext.builder().addBinding(ID, typedValue).addBinding(OTHER_ID, typedValue).addModule(module).build();
BindingContext context = builder.addAll(previousContext).build();
assertThat(context.bindings(), hasSize(2));
assertThat(context.identifiers(), hasItems(ID, OTHER_ID));
assertThat(context.lookup(ID).get(), is(sameInstance(typedValue)));
assertThat(context.lookup(OTHER_ID).get(), is(sameInstance(typedValue)));
assertThat(context.modules(), hasSize(1));
assertThat(context.modules(), hasItems(module));
Collection<Binding> moduleBindings = context.modules().iterator().next().bindings();
assertThat(moduleBindings, hasSize(1));
assertThat(moduleBindings.iterator().next().identifier(), is(ID));
}
Aggregations