### Question:
QueryParser { public List<ConditionalExpression> getQuery() { return query; } QueryParser(String input); boolean isDirectQuery(); String getQueriedJMBAG(); List<ConditionalExpression> getQuery();  }### Answer:
@Test void testParsingIgnoresWhitespace() { List<ConditionalExpression> query = new QueryParser(" lastName=\"Bosnić\"").getQuery(); String[] sameQueries = { " lastName=\"Bosnić\"", " lastName =\"Bosnić\"", " lastName= \"Bosnić\"", " lastName = \"Bosnić\"" }; for (String input : sameQueries) { assertEquals(query, new QueryParser(input).getQuery()); } }
@Test void testDirectQueryFromPDF() { List<ConditionalExpression> query = new QueryParser("jmbag = \"0000000003\"").getQuery(); assertEquals(1, query.size()); ConditionalExpression actual = query.get(0); ConditionalExpression expected = new ConditionalExpression(FieldValueGetters.JMBAG, "0000000003", ComparisonOperators.EQUALS); assertEquals(expected, actual); }
@Test void testTwoPartQueryFromPDF1() { List<ConditionalExpression> query = new QueryParser("jmbag = \"0000000003\" AND lastName LIKE \"B*\"").getQuery(); assertEquals(2, query.size()); ConditionalExpression expected1 = new ConditionalExpression(FieldValueGetters.JMBAG, "0000000003", ComparisonOperators.EQUALS); ConditionalExpression expected2 = new ConditionalExpression(FieldValueGetters.LAST_NAME, "B*", ComparisonOperators.LIKE); assertEquals(expected1, query.get(0)); assertEquals(expected2, query.get(1)); }
@Test void testTwoPartQueryFromPDF2() { List<ConditionalExpression> query = new QueryParser(" jmbag = \"0000000003\" AND lastName LIKE \"L*\"").getQuery(); assertEquals(2, query.size()); ConditionalExpression expected1 = new ConditionalExpression(FieldValueGetters.JMBAG, "0000000003", ComparisonOperators.EQUALS); ConditionalExpression expected2 = new ConditionalExpression(FieldValueGetters.LAST_NAME, "L*", ComparisonOperators.LIKE); assertEquals(expected1, query.get(0)); assertEquals(expected2, query.get(1)); }
@Test void testOnePartQueryFromPDF1() { List<ConditionalExpression> query = new QueryParser("lastName LIKE \"B*\"").getQuery(); assertEquals(1, query.size()); ConditionalExpression expected = new ConditionalExpression(FieldValueGetters.LAST_NAME, "B*", ComparisonOperators.LIKE); assertEquals(expected, query.get(0)); }
@Test void testOnePartQueryFromPDF2() { List<ConditionalExpression> query = new QueryParser("lastName LIKE \"Be*\"").getQuery(); assertEquals(1, query.size()); ConditionalExpression expected = new ConditionalExpression(FieldValueGetters.LAST_NAME, "Be*", ComparisonOperators.LIKE); assertEquals(expected, query.get(0)); }