コード例 #1
0
  @SuppressWarnings("unchecked")
  @Test
  public void headerContains() throws Exception {
    this.request.getHeaders().put("foo", Arrays.asList("bar", "baz"));

    MockRestRequestMatchers.header("foo", containsString("ba")).match(this.request);
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  @Test(expected = AssertionError.class)
  public void headerContainsWithMissingValue() throws Exception {
    this.request.getHeaders().put("foo", Arrays.asList("bar", "baz"));

    MockRestRequestMatchers.header("foo", containsString("bx")).match(this.request);
  }
コード例 #3
0
  @Test(expected = AssertionError.class)
  public void headerMissingValue() throws Exception {
    this.request.getHeaders().put("foo", Arrays.asList("bar", "baz"));

    MockRestRequestMatchers.header("foo", "bad").match(this.request);
  }
コード例 #4
0
 @Test(expected = AssertionError.class)
 public void headerMissing() throws Exception {
   MockRestRequestMatchers.header("foo", "bar").match(this.request);
 }
コード例 #5
0
  @Test
  public void header() throws Exception {
    this.request.getHeaders().put("foo", Arrays.asList("bar", "baz"));

    MockRestRequestMatchers.header("foo", "bar", "baz").match(this.request);
  }
コード例 #6
0
  @Test(expected = AssertionError.class)
  public void methodNoMatch() throws Exception {
    this.request.setMethod(HttpMethod.POST);

    MockRestRequestMatchers.method(HttpMethod.GET).match(this.request);
  }
コード例 #7
0
  @Test
  public void method() throws Exception {
    this.request.setMethod(HttpMethod.GET);

    MockRestRequestMatchers.method(HttpMethod.GET).match(this.request);
  }
コード例 #8
0
  @Test
  public void requestToContains() throws Exception {
    this.request.setURI(new URI("http://foo.com/bar"));

    MockRestRequestMatchers.requestTo(containsString("bar")).match(this.request);
  }
コード例 #9
0
  @Test(expected = AssertionError.class)
  public void requestToNoMatch() throws Exception {
    this.request.setURI(new URI("http://foo.com/bar"));

    MockRestRequestMatchers.requestTo("http://foo.com/wrong").match(this.request);
  }
コード例 #10
0
 @SuppressWarnings("unchecked")
 @Test(expected = AssertionError.class)
 public void headerContainsWithMissingHeader() throws Exception {
   MockRestRequestMatchers.header("foo", containsString("baz")).match(this.request);
 }