コード例 #1
0
  @Test
  public void noMatch() {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");

    RequestMethodsRequestCondition rm = new RequestMethodsRequestCondition(RequestMethod.POST);
    RequestConditionHolder custom = new RequestConditionHolder(rm);

    assertNull(custom.getMatchingCondition(request));
  }
コード例 #2
0
  @Test
  public void match() {
    MockHttpServletRequest request = new MockHttpServletRequest("GET", "/");
    request.setParameter("name1", "value1");

    RequestMethodsRequestCondition rm =
        new RequestMethodsRequestCondition(RequestMethod.GET, RequestMethod.POST);
    RequestConditionHolder custom = new RequestConditionHolder(rm);
    RequestMethodsRequestCondition expected = new RequestMethodsRequestCondition(RequestMethod.GET);

    assertEquals(expected, custom.getMatchingCondition(request).getCondition());
  }
コード例 #3
0
 @Test
 public void matchEmpty() {
   RequestConditionHolder empty = new RequestConditionHolder(null);
   assertSame(empty, empty.getMatchingCondition(new MockHttpServletRequest()));
 }