### Question:
ParseFilter { public Filter parseFilterString (String filterString) throws CharacterCodingException { return parseFilterString(Bytes.toBytes(filterString)); }  Filter parseFilterString(String filterString); Filter parseFilterString(byte [] filterStringAsByteArray); byte [] extractFilterSimpleExpression(byte [] filterStringAsByteArray,
                                                int filterExpressionStartOffset); Filter parseSimpleFilterExpression(byte [] filterStringAsByteArray); static byte [] getFilterName(byte [] filterStringAsByteArray); static ArrayList<byte []> getFilterArguments(byte [] filterStringAsByteArray); void reduce(Stack<ByteBuffer> operatorStack,
                     Stack<Filter> filterStack,
                     ByteBuffer operator); static Filter popArguments(Stack<ByteBuffer> operatorStack, Stack <Filter> filterStack); boolean hasHigherPriority(ByteBuffer a, ByteBuffer b); static byte [] createUnescapdArgument(byte [] filterStringAsByteArray,
                                                int argumentStartIndex, int argumentEndIndex); static boolean checkForOr(byte [] filterStringAsByteArray, int indexOfOr); static boolean checkForAnd(byte [] filterStringAsByteArray, int indexOfAnd); static boolean checkForSkip(byte [] filterStringAsByteArray, int indexOfSkip); static boolean checkForWhile(byte [] filterStringAsByteArray, int indexOfWhile); static boolean isQuoteUnescaped(byte [] array, int quoteIndex); static byte [] removeQuotesFromByteArray(byte [] quotedByteArray); static int convertByteArrayToInt(byte [] numberAsByteArray); static long convertByteArrayToLong(byte [] numberAsByteArray); static boolean convertByteArrayToBoolean(byte [] booleanAsByteArray); static CompareFilter.CompareOp createCompareOp(byte [] compareOpAsByteArray); static WritableByteArrayComparable createComparator(byte [] comparator); static byte [][] parseComparator(byte [] comparator); Set<String> getSupportedFilters(); static Map<String, String> getAllFilters(); static void registerFilter(String name, String filterClass);  }### Answer:
@Test public void testKeyOnlyFilter() throws IOException { String filterString = "KeyOnlyFilter()"; doTestFilter(filterString, KeyOnlyFilter.class); String filterString2 = "KeyOnlyFilter ('') "; byte [] filterStringAsByteArray2 = Bytes.toBytes(filterString2); try { filter = f.parseFilterString(filterStringAsByteArray2); assertTrue(false); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } }
@Test public void testFirstKeyOnlyFilter() throws IOException { String filterString = " FirstKeyOnlyFilter( ) "; doTestFilter(filterString, FirstKeyOnlyFilter.class); String filterString2 = " FirstKeyOnlyFilter ('') "; byte [] filterStringAsByteArray2 = Bytes.toBytes(filterString2); try { filter = f.parseFilterString(filterStringAsByteArray2); assertTrue(false); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } }
@Test public void testIncorrectFilterString () throws IOException { String filterString = "()"; byte [] filterStringAsByteArray = Bytes.toBytes(filterString); try { filter = f.parseFilterString(filterStringAsByteArray); assertTrue(false); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } }