コード例 #1
0
  @Test
  public void combineEmpty() {
    RequestConditionHolder empty = new RequestConditionHolder(null);
    RequestConditionHolder notEmpty =
        new RequestConditionHolder(new ParamsRequestCondition("name"));

    assertSame(empty, empty.combine(empty));
    assertSame(notEmpty, notEmpty.combine(empty));
    assertSame(notEmpty, empty.combine(notEmpty));
  }
コード例 #2
0
 @Test(expected = ClassCastException.class)
 public void combineIncompatible() {
   RequestConditionHolder params = new RequestConditionHolder(new ParamsRequestCondition("name"));
   RequestConditionHolder headers =
       new RequestConditionHolder(new HeadersRequestCondition("name"));
   params.combine(headers);
 }
コード例 #3
0
  @Test
  public void combine() {
    RequestConditionHolder params1 =
        new RequestConditionHolder(new ParamsRequestCondition("name1"));
    RequestConditionHolder params2 =
        new RequestConditionHolder(new ParamsRequestCondition("name2"));
    RequestConditionHolder expected =
        new RequestConditionHolder(new ParamsRequestCondition("name1", "name2"));

    assertEquals(expected, params1.combine(params2));
  }