Ejemplo n.º 1
0
  /** Ensure can load explicit {@link WoofTemplateExtensionSource}. */
  public void testExplicitTemplateExtension() throws Exception {

    final HttpTemplateAutoWireSection template = this.createMock(HttpTemplateAutoWireSection.class);

    // Record initiating from source context
    this.recordInitateFromSourceContext();
    MockImplicitWoofTemplateExtensionSourceService.reset("example");

    // Record loading template
    this.recordReturn(
        this.app,
        this.app.addHttpTemplate("example", "WOOF/Template.html", Template.class),
        template);
    template.setTemplateSecure(false);

    // Record extending with explicit template extension
    this.recordTemplateExtension(MockExplicitWoofTemplateExtensionSource.class);
    this.recordReturn(template, template.getTemplateUri(), "URI");

    // Record implicit template extensions
    this.recordImplicitTemplateExtensions(template, "example");

    // Test
    this.replayMockObjects();
    this.loader.loadWoofConfiguration(
        this.getConfiguration("explicit-template-extension.woof"), this.app, this.sourceContext);
    this.verifyMockObjects();
  }
Ejemplo n.º 2
0
  /**
   * Records implicit {@link WoofTemplateExtensionSource} on the {@link
   * HttpTemplateAutoWireSection}.
   *
   * @param template {@link HttpTemplateAutoWireSection}.
   * @param templateUri URI.
   */
  private void recordImplicitTemplateExtensions(
      HttpTemplateAutoWireSection template, String templateUri) {

    // Record the template extension
    this.recordTemplateExtension(MockImplicitWoofTemplateExtensionSourceService.class);

    // Record obtain the template URI (ensure implicit used)
    this.recordReturn(template, template.getTemplateUri(), templateUri);
  }