Package fitnesse.http

Examples of fitnesse.http.MockResponseSender


    WikiPagePath testPagePath = testPage.getPageCrawler().getFullPath();
    String resource = PathParser.render(testPagePath);
    request.setResource(resource);

    Response response = responder.makeResponse(context, request);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    results = sender.sentData();

    WikiPage errorLog = errorLogsParentPage.getPageCrawler().getPage(testPagePath);
    String errorLogContent = errorLog.getData().getContent();
    assertMessagesOccurInOrder(errorLogContent, "Output of SuiteSetUp", "Output of SetUp", "Output of TestPage", "Output of TearDown", "Output of SuiteTearDown");
    assertMessageHasJustOneOccurrenceOf(errorLogContent, "Output of SetUp");
View Full Code Here


  }

  @Test
  public void testHtmlOfMakeResponse() throws IOException {
    Response response = makeSampleResponse(baseUrl);
    MockResponseSender sender = new MockResponseSender();
    ((ChunkedResponse) response).turnOffChunking();
    sender.doSending(response);
    String content = sender.sentData();

    assertSubString("<html>", content);
    assertSubString("Wiki Import", content);

    assertSubString("PageTwo", content);
View Full Code Here

  }

  @Test
  public void testHtmlOfMakeResponseWithNoModifications() throws Exception {
    Response response = makeSampleResponse(baseUrl);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);

    // import a second time... nothing was modified
    createResponder();
    response = makeSampleResponse(baseUrl);
    sender = new MockResponseSender();
    sender.doSending(response);
    String content = sender.sentData();

    assertSubString("<html>", content);
    assertSubString("Wiki Import", content);

    assertSubString("PageTwo", content);
View Full Code Here

  @Test
  public void testMakeResponseImportingNonRootPage() throws Exception {
    MockRequest request = makeRequest(baseUrl + "PageOne");

    Response response = responder.makeResponse(FitNesseUtil.makeTestContext(testData.localRoot), request);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String content = sender.sentData();

    assertNotNull(testData.pageTwo.getChildPage("ChildOne"));
    assertSubString("PageTwo.ChildOne", content);
    assertSubString("ChildOne", content);
  }
View Full Code Here

  @Test
  public void testRemoteUrlNotFound() throws Exception {
    String remoteUrl = baseUrl + "PageDoesntExist";
    Response response = makeSampleResponse(remoteUrl);

    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String content = sender.sentData();
    assertSubString("The remote resource, " + remoteUrl + ", was not found.", content);
  }
View Full Code Here

  @Test
  public void testErrorMessageForBadUrlProvided() throws Exception {
    String remoteUrl = baseUrl + "+blah";
    Response response = makeSampleResponse(remoteUrl);

    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String content = sender.sentData();
    assertSubString("The URL's resource path, +blah, is not a valid WikiWord.", content);
  }
View Full Code Here

    FitNesseUtil.destroyTestContext();
  }

  private String runSuite() throws Exception {
    Response response = responder.makeResponse(context, request);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String results = sender.sentData();
    return results;
  }
View Full Code Here

    WikiImporter importer = new WikiImporter();
    importer.setDeleteOrphanOption(false);
    responder = new WikiImportingResponder(importer);
    responder.path = new WikiPagePath();
    ChunkedResponse response = new ChunkedResponse("html", new MockChunkedDataProvider());
    response.sendTo(new MockResponseSender());
    responder.setResponse(response);
  }
View Full Code Here

  @Test
  public void testUnauthorizedResponse() throws Exception {
    makeSecurePage(testData.remoteRoot);

    Response response = makeSampleResponse(baseUrl);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String content = sender.sentData();
    checkRemoteLoginForm(content);
  }
View Full Code Here

  public void testUnauthorizedResponseFromNonRoot() throws Exception {
    WikiPage childPage = testData.remoteRoot.getChildPage("PageOne");
    makeSecurePage(childPage);

    Response response = makeSampleResponse(baseUrl);
    MockResponseSender sender = new MockResponseSender();
    sender.doSending(response);
    String content = sender.sentData();
    assertSubString("The wiki at " + baseUrl + "PageOne requires authentication.", content);
    assertSubString("<form", content);
  }
View Full Code Here

TOP

Related Classes of fitnesse.http.MockResponseSender

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.