@Test
public void testDataToRetrieve() throws Exception {

  String expr = "abc,def";
  TimelineFilterList expectedList = new TimelineFilterList(Operator.OR,
      new TimelinePrefixFilter(TimelineCompareOp.EQUAL, "abc"),
      new TimelinePrefixFilter(TimelineCompareOp.EQUAL, "def")
  );
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "(abc,def)";
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "   (   abc  ,   def  )   ";
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "    abc  ,   def   ";
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "!(abc,def)";
  expectedList = new TimelineFilterList(
      new TimelinePrefixFilter(TimelineCompareOp.NOT_EQUAL, "abc"),
      new TimelinePrefixFilter(TimelineCompareOp.NOT_EQUAL, "def")
  );
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = " !  (   abc  ,  def  )  ";
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "!(abc)";
  expectedList = new TimelineFilterList(
      new TimelinePrefixFilter(TimelineCompareOp.NOT_EQUAL, "abc")
  );
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "(abc)";
  expectedList = new TimelineFilterList(Operator.OR,
      new TimelinePrefixFilter(TimelineCompareOp.EQUAL, "abc")
  );
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "abc";
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = " !  (   abc  ,  def  , xyz)  ";
  expectedList = new TimelineFilterList(
      new TimelinePrefixFilter(TimelineCompareOp.NOT_EQUAL, "abc"),
      new TimelinePrefixFilter(TimelineCompareOp.NOT_EQUAL, "def"),
      new TimelinePrefixFilter(TimelineCompareOp.NOT_EQUAL, "xyz")
  );
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "!(abc,def,xyz)";
  verifyFilterList(expr,
      TimelineReaderWebServicesUtils.parseDataToRetrieve(expr), expectedList);
  expr = "!(abc,def,xyz";
  try {
    TimelineReaderWebServicesUtils.parseDataToRetrieve(expr);
    fail("No closing bracket. Exception should have been thrown");
  } catch (TimelineParseException e){}
  expr = "!abc,def,xyz";
  try {
    TimelineReaderWebServicesUtils.parseDataToRetrieve(expr);
    fail("NOT(!) should be followed by opening bracket. Exception should " +
        "have been thrown");
  } catch (TimelineParseException e){}
  expr = "!abc,def,xyz";
  try {
    TimelineReaderWebServicesUtils.parseDataToRetrieve(expr);
    fail("NOT(!) should be followed by opening bracket. Exception should " +
        "have been thrown");
  } catch (TimelineParseException e){}
  expr = "!   r(  abc,def,xyz)";
  try {
    TimelineReaderWebServicesUtils.parseDataToRetrieve(expr);
    fail("NOT(!) should be followed by opening bracket. Exception should " +
        "have been thrown");
  } catch (TimelineParseException e){}
  assertNull(TimelineReaderWebServicesUtils.parseDataToRetrieve(null));
  assertNull(TimelineReaderWebServicesUtils.parseDataToRetrieve("     "));
  assertNull(TimelineReaderWebServicesUtils.parseDataToRetrieve("()"));
  assertNull(TimelineReaderWebServicesUtils.parseDataToRetrieve("!()"));
  assertNull(TimelineReaderWebServicesUtils.parseDataToRetrieve("(     )"));
  assertNull(TimelineReaderWebServicesUtils.parseDataToRetrieve("!(   )"));
  assertNull(TimelineReaderWebServicesUtils.parseDataToRetrieve("!  (   )"));
}