Example #1
0
  @Test
  public void value() throws Exception {
    // then
    assertThat(rowsUnderTest.size()).isEqualTo(3);

    List<GoogleRow> rows = RowFilter.filter(rowsUnderTest, new RowFilter_Value("lastname", "Kong"));
    assertThat(rowsUnderTest.size()).isEqualTo(3); // didn't change original list

    assertThat(rows.size()).isEqualTo(1);
    assertThat(rows.get(0).getValue("firstname")).isEqualTo("King");
  }
Example #2
0
  @Test
  public void weekday() throws Exception {
    // then
    assertThat(rowsUnderTest.size()).isEqualTo(3);

    List<GoogleRow> rows =
        RowFilter.filter(rowsUnderTest, new RowFilter_Weekday("holidaydate", "Wednesday"));
    assertThat(rowsUnderTest.size()).isEqualTo(3); // didn't change original list

    assertThat(rows.size()).isEqualTo(1);
    assertThat(rows.get(0).getValue("firstname")).isEqualTo("Kevin");
  }
Example #3
0
  @Test
  public void maxCount() throws Exception {
    // then
    assertThat(rowsUnderTest.size()).isEqualTo(3);

    List<GoogleRow> rows = RowFilter.filter(rowsUnderTest, new RowFilter_MaxCount(2));
    assertThat(rowsUnderTest.size()).isEqualTo(3); // didn't change original list

    // first two, in order
    assertThat(rows.size()).isEqualTo(2);
    assertThat(rows.get(0).getValue("firstname")).isEqualTo("King");
    assertThat(rows.get(1).getValue("firstname")).isEqualTo("Kevin");
  }