Package fitnesse

Examples of fitnesse.Responder


    context = FitNesseUtil.makeTestContext();
  }

  @Test
  public void testResponse() throws Exception {
    Responder responder = new DisabledResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, new MockRequest());

    assertEquals(200, response.getStatus());

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


  }

  @Test
  public void testDirectotyListing() throws Exception {
    request.setResource("files/testDir/");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    response = (SimpleResponse) responder.makeResponse(context, request);
    assertHasRegexp("testDir", response.getContent());
    assertHasRegexp("testFile2", response.getContent());
    assertHasRegexp("testFile3", response.getContent());
    assertHasRegexp("<a href=\"/", response.getContent());
  }
View Full Code Here

  }

  @Test
  public void testButtons() throws Exception {
    request.setResource("files/testDir/");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    response = (SimpleResponse) responder.makeResponse(context, request);

    assertHasRegexp("Upload", response.getContent());
    assertHasRegexp("Create", response.getContent());
  }
View Full Code Here

  }

  @Test
  public void testHtml() throws Exception {
    request.setResource("files/testDir/");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    response = (SimpleResponse) responder.makeResponse(context, request);
    assertHasRegexp("/files/", response.getContent());
  }
View Full Code Here

  }

  @Test
  public void testRedirectForDirectory() throws Exception {
    request.setResource("files/testDir");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    Response response = responder.makeResponse(context, request);
    assertEquals(303, response.getStatus());
    assertEquals("/files/testDir/", response.getHeader("Location"));
  }
View Full Code Here

  }

  @Test
  public void testNotFoundFile() throws Exception {
    request.setResource("files/something/that/aint/there");
    Responder notFoundResponder = FileResponder.makeResponder(request, context.getRootPagePath());
    SimpleResponse response = (SimpleResponse) notFoundResponder.makeResponse(context, request);
    assertEquals(404, response.getStatus());
    assertHasRegexp("files/something/that/aint/there", response.getContent());
  }
View Full Code Here

  }

  @Test
  public void shouldNotDealWithDirectoryOutsideFilesFolder() throws Exception {
    request.setResource("/files/../../");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    Response response = responder.makeResponse(context, request);
    assertTrue(responder instanceof ErrorResponder);
    assertEquals(400, response.getStatus());
  }
View Full Code Here

  }

  @Test
  public void shouldNotDealWithEscapedDirectoryOutsideFilesFolder() throws Exception {
    request.setResource("/files/..%2f/");
    Responder responder = FileResponder.makeResponder(request, context.getRootPagePath());
    Response response = responder.makeResponse(context, request);
    assertTrue(responder instanceof ErrorResponder);
    assertEquals(400, response.getStatus());
  }
View Full Code Here

    factory.addResponder("custom", WikiPageResponder.class);
    assertResponderTypeMatchesInput("custom", WikiPageResponder.class);
  }

  private void assertResponderType(Class<?> expectedClass) throws Exception {
    Responder responder = factory.makeResponder(request);
    assertEquals(expectedClass, responder.getClass());
  }
View Full Code Here

  @Test
  public void testContentOfPage() throws Exception {
    request.setResource("files");
    request.addInput("filename", "MyFile.txt");
    Responder responder = new DeleteConfirmationResponder();
    SimpleResponse response = (SimpleResponse) responder.makeResponse(context, request);
    String content = response.getContent();

    assertSubString("deleteFile", content);
    assertSubString("Delete File", content);
    assertSubString("MyFile.txt", content);
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.