Package fitnesse

Examples of fitnesse.Responder


    context = FitNesseUtil.makeTestContext();
  }

  @Test
  public void testResponse() throws Exception {
    Responder responder = new ErrorResponder(new Exception("some error message"));
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, new MockRequest());

    assertEquals(400, response.getStatus());

    String body = response.getContent();
View Full Code Here


    assertHasRegexp("java.lang.Exception: some error message", body);
  }

  @Test
  public void testWithMessage() throws Exception {
    Responder responder = new ErrorResponder("error Message");
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, new MockRequest());
    String body = response.getContent();

    assertSubString("error Message", body);
  }
View Full Code Here

    context = FitNesseUtil.makeTestContext();
  }

  @Test
  public void canAddFiltersForAResponder() throws Exception {
    Responder responder = factory.makeResponder(request);
    expectedFilterResponse = new SimpleResponse();
    Response response = responder.makeResponse(context, request);

    assertSame(expectedFilterResponse, response);
  }
View Full Code Here

    assertSame(expectedFilterResponse, response);
  }

  @Test
  public void shouldCallResponderIfFilterReturnsNull() throws Exception {
    Responder responder = factory.makeResponder(request);
    expectedResponderResponse = new SimpleResponse();
    Response response = responder.makeResponse(context, request);

    assertSame(expectedResponderResponse, response);
  }
View Full Code Here

  }

  @Test
  public void shouldExecuteMultipleFilters() throws Exception {
    factory.addFilter("mock", new AnotherMockFilter());
    Responder responder = factory.makeResponder(request);
    expectedAnotherFilterResponse = new SimpleResponse();
    Response response = responder.makeResponse(context, request);

    assertSame(expectedAnotherFilterResponse, response);
  }
View Full Code Here

  @Test
  public void testResponse() throws Exception {
    MockRequest request = new MockRequest();
    request.setResource("some page");

    Responder responder = new NotFoundResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);

    assertEquals(404, response.getStatus());

    String body = response.getContent();
View Full Code Here

  public void testHasEditLinkForWikiWords() throws Exception {
    MockRequest request = new MockRequest();
    request.setResource("PageOne.PageTwo");
    WikiPage root = InMemoryPage.makeRoot("RooT");

    Responder responder = new NotFoundResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(FitNesseUtil.makeTestContext(root), request);

    assertHasRegexp("\"PageOne[.]PageTwo[?]edit\"", response.getContent());
  }
View Full Code Here

    page.commit(data);

    final MockRequest request = new MockRequest();
    request.setResource("ChildPage");

    final Responder responder = new WikiPageResponder();
    final SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);

    assertEquals(200, response.getStatus());

    final String body = response.getContent();
View Full Code Here

    WikiPage childPage = WikiPageUtil.addPage(page, PathParser.parse("child_page"), "child content");

    final MockRequest request = new MockRequest();
    request.setResource("page.child_page");

    final Responder responder = new WikiPageResponder();
    final SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);

    assertEquals(200, response.getStatus());

    final String body = response.getContent();
View Full Code Here

    request.setResource(name);

    for(String input: inputs.keySet()){
        request.addInput(input, inputs.get(input));
    }
    final Responder responder = new WikiPageResponder();
    return (SimpleResponse) responder.makeResponse(context, request);
  }
View Full Code Here

TOP

Related Classes of fitnesse.Responder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.