コード例 #1
0
  @Test
  public void testAfter() throws IOException, ParserConfigurationException {

    RestHook restHook = new RestHook();
    restHook.afterHook();

    assertNull(RestContext.clientResponse);
    assertNull(RestContext.method);
    assertNull(RestContext.postBody);
    assertNull(RestContext.restResponse);
    assertNull(RestContext.webresource);
    assertThat(RestContext.headerMapList.toArray(), arrayWithSize(0));
    assertTrue(RestContext.restProps.isEmpty());
  }
コード例 #2
0
  @Test
  public void testBefore() throws ParserConfigurationException {
    System.setProperty("env", "junit");
    System.setProperty("prop3", "restsalad.sysprop");

    RestHook restHook = new RestHook();
    restHook.beforeHook();

    assertNull(RestContext.clientResponse);
    assertNull(RestContext.method);
    assertNull(RestContext.postBody);
    assertNull(RestContext.restResponse);
    assertNull(RestContext.webresource);
    assertThat(RestContext.headerMapList.toArray(), arrayWithSize(0));
    assertEquals("restsalad", RestContext.restProps.get("prop1"));
    assertEquals("restsalad.junit", RestContext.restProps.get("prop2"));
    assertEquals("restsalad.sysprop", RestContext.restProps.get("prop3"));
  }