Ejemplo n.º 1
0
  public void customElResolversWithoutBaseShouldBeConfigurable() {
    ConfigurationParameters parameters = new ConfigurationParameters();
    parameters.addParameter(
        ElContext.EL_RESOLVER_WITHOUT_BASE_PACKAGES,
        ReflectionUtilities.getPackageName(DictionaryElResolver.class));

    ElContext elContext = new ElContext(new DefaultContext(), new TestConfiguration(parameters));
    ELResolver elResolver = elContext.getELResolver();

    assert elResolver.getValue(elContext, null, "en_nl") instanceof Dictionary;
  }
Ejemplo n.º 2
0
  @Test(dependsOnMethods = "customElResolversWithoutBaseShouldBeConfigurable")
  public void customElResolversWithBaseShouldBeConfigurable() {
    ConfigurationParameters parameters = new ConfigurationParameters();
    parameters.addParameter(
        ElContext.EL_RESOLVER_WITHOUT_BASE_PACKAGES,
        ReflectionUtilities.getPackageName(DictionaryElResolver.class));
    parameters.addParameter(
        ElContext.EL_RESOLVER_WITH_BASE_PACKAGES,
        ReflectionUtilities.getPackageName(TranslationElResolver.class));

    ElContext elContext = new ElContext(new DefaultContext(), new TestConfiguration(parameters));
    ELResolver elResolver = elContext.getELResolver();

    Object translation =
        elResolver.getValue(elContext, elResolver.getValue(elContext, null, "nl_en"), "boom");
    assert translation instanceof String;
    assert translation.equals("tree");
  }