Ejemplo n.º 1
0
  @Before
  public void setup() {
    this.portalRequest = new PortalRequest();
    this.portalResponse = PortalResponse.create().build();
    mockCurrentContextHttpRequest();

    this.injection = new LiveEditInjection();
  }
Ejemplo n.º 2
0
  @Test
  public void getContentFound() throws Exception {
    setupContentAndSite();
    setupTemplates();

    final PortalResponse portalResponse =
        PortalResponse.create()
            .body("component rendered")
            .header("some-header", "some-value")
            .status(HttpStatus.OK)
            .build();

    setRendererResult(portalResponse);

    this.request.setContentPath(ContentPath.from("/site/somepath/content"));

    final PortalResponse res = this.handler.handle(this.request);
    assertNotNull(res);
    assertEquals(HttpStatus.OK, res.getStatus());
    assertEquals(MediaType.PLAIN_TEXT_UTF_8, res.getContentType());
    assertEquals("some-value", res.getHeaders().get("some-header"));
    assertEquals("component rendered", res.getBody());
  }