### Question:
LineParser { @SuppressWarnings("unchecked") public static Object parseInput(String s) { boolean requiresLeftBoundary = false; boolean requiresRightBoundary = false; s = s.trim(); String rawInput = s; if (s.length() > 0 && s.charAt(0) == BOUNDARY) { requiresLeftBoundary = true; s = s.substring(1).trim(); } if (s.length() > 0 && s.charAt(s.length() - 1) == BOUNDARY) { requiresRightBoundary = true; s = s.substring(0, s.length() - 1).trim(); } int pos = s.indexOf('*'); if (pos > -1) { if (pos < (s.length() - 1)) { return new ValidationError(WILDCARD + " is only allowed at the end of the input: " + s); } else if (requiresRightBoundary) { return new ValidationError(WILDCARD + " cannot be combined with right boundary"); } } final Object expr = parseTermExpression(s); if (expr instanceof ValidationError) { return expr; } else { return new Input((List<Term>) expr, requiresLeftBoundary, requiresRightBoundary, rawInput); } }  static Object parse(final String line, final Input previousInput,
                               final QuerqyParserFactory querqyParserFactory); static Object parseDecorateInstruction(String line); static Object parseBoostInstruction(String line, String lcLine, int lengthPredicate, BoostDirection direction, QuerqyParserFactory querqyParserFactory); @SuppressWarnings("unchecked") static Object parseInput(String s); static Term parseTerm(String s); static List<String> parseFieldNames(String s); static final char BOUNDARY; static final char WILDCARD; static final String INSTR_BOOST_DOWN; static final String INSTR_BOOST_UP; static final String INSTR_DECORATE; static final String INSTR_DELETE; static final String INSTR_FILTER; static final String INSTR_SYNONYM; }### Answer:
@Test public void testThatWildcardCannotBeFollowedByRightBoundary() { Object parseResult = LineParser.parseInput("a" + LineParser.WILDCARD + LineParser.BOUNDARY); assertEquals("Wildcard should not be allowed before right boundary", new ValidationError(LineParser.WILDCARD + " cannot be combined with right boundary"), parseResult); }
@Test public void testThatWildcardCanBeCombinedWithLeftBoundary() { Object parseResult = LineParser.parseInput(LineParser.BOUNDARY + "a" + LineParser.WILDCARD); assertTrue(parseResult instanceof Input); Input input = (Input) parseResult; assertTrue(input.requiresLeftBoundary()); assertFalse(input.requiresRightBoundary()); }
@Test public void testThatBoundariesAreParsedInInput() { Object parseResult = LineParser.parseInput(LineParser.BOUNDARY + "a" + LineParser.BOUNDARY); assertTrue(parseResult instanceof Input); Input input = (Input) parseResult; assertTrue(input.requiresLeftBoundary()); assertTrue(input.requiresRightBoundary()); }
@Test public void testThatBoundariesAreParsedInOtherwiseEmptyInput() { Object parseResult = LineParser.parseInput(LineParser.BOUNDARY + "" + LineParser.BOUNDARY); assertTrue(parseResult instanceof Input); Input input = (Input) parseResult; assertTrue(input.requiresLeftBoundary()); assertTrue(input.requiresRightBoundary()); }
@Test public void testInputWithWildcard() { assertTrue("parseInput must not allow wildcard in the middle", LineParser.parseInput("abc* def ghij*") instanceof ValidationError); }