Package foo.domaintest.util.testutil

Examples of foo.domaintest.util.testutil.FakeResponse


  @Rule public TestEnvironment env = new TestEnvironment(new LocalMemcacheServiceTestConfig());

  public StashActionTest() {
    action.memcache = memcache;
    action.lazyRandomToken = lazy("token");
    action.response = new FakeResponse();
    action.tempUrlFactory = new TempUrlFactory(TESTING_URL_BASE + "/stash");
  }
View Full Code Here


  }

  void runServletVerifyCaching(Map<String, Object> expectedParams) throws Exception {
    action.run();
    assertEquals(
        new FakeResponse().setPayload(TESTING_URL_BASE + "/temp/token"),
        action.response);
    assertTrue(((FakeResponse) action.response).isResponseSent());
    assertEquals(expectedParams, memcache.load(new Key(STASH, "token")));
  }
View Full Code Here

    action.cookiesToAdd = ImmutableMap.of("j", "k", "m", "");
    action.headers = ImmutableMap.of("aa", "bb", "cc", "");
    action.payload = "foo";
    action.run();
    assertEquals(
        new FakeResponse().setPayload(TESTING_URL_BASE + "/temp/token"),
        action.response);
    assertTrue(((FakeResponse) action.response).isResponseSent());
    assertEquals(
        new ImmutableMap.Builder<String, Object>()
            .put("status", action.status)
View Full Code Here

  @Test
  public void testNoneSet() {
    action.run();
    assertEquals(
        new FakeResponse().setPayload(TESTING_URL_BASE + "/temp/token"),
        action.response);
    assertTrue(((FakeResponse) action.response).isResponseSent());
    Map<String, Object> expected = new HashMap<>();
    expected.put("status", null);
    expected.put("sleepSeconds", null);
View Full Code Here

    action.requestPath = "http://testing.example/temp/token";
  }

  @Test
  public void testTemp() {
    action.response = new FakeResponse();
    memcache.save(
        new Key(STASH, "token"),
        new ImmutableMap.Builder<String, Object>()
            .put("status", 234)
            .put("sleepSeconds", 5)
            .put("mimeType", "a/b")
            .put("cookiesToDelete", ImmutableList.of("x", "y"))
            .put("cookiesToAdd", ImmutableMap.of("j", "k", "m", ""))
            .put("headers", ImmutableMap.of("aa", "bb", "cc", ""))
            .put("payload", "foo")
            .build(),
        null);
    action.run();
    assertEquals(
        new FakeResponse()
            .setStatus(234)
            .setSleepSeconds(5)
            .setMimeType("a/b")
            .setCookiesToDelete(ImmutableList.of("x", "y"))
            .setCookiesToAdd(ImmutableMap.of("j", "k", "m", ""))
View Full Code Here

  EchoAction action  = new EchoAction();

  @Test
  public void testEcho() {
    action.response = new FakeResponse();
    action.status = 234;
    action.sleepSeconds = 5;
    action.mimeType = "a/b";
    action.cookiesToDelete = ImmutableList.of("x", "y");
    action.cookiesToAdd = ImmutableMap.of("j", "k", "m", "");
    action.headers = ImmutableMap.of("aa", "bb", "cc", "");
    action.payload = "foo";
    action.run();
    assertEquals(
        new FakeResponse()
            .setStatus(234)
            .setSleepSeconds(5)
            .setMimeType("a/b")
            .setCookiesToDelete(ImmutableList.of("x", "y"))
            .setCookiesToAdd(ImmutableMap.of("j", "k", "m", ""))
View Full Code Here

  @Test
  public void testSavesAndReturnsToken() {
    TokenAction action = new TokenAction();
    action.memcache = new Memcache(null, mock(Metrics.class));
    action.response = new FakeResponse();
    action.randomToken = "token";
    action.run();
    assertEquals(
        new FakeResponse().setPayload("token"),
        action.response);
    assertTrue(((FakeResponse) action.response).isResponseSent());
    assertTrue((boolean) action.memcache.load(new Key(TOKEN, "token")));
  }
View Full Code Here

TOP

Related Classes of foo.domaintest.util.testutil.FakeResponse

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.