@Test void testReturnOnlyOneForHitBothBeforeAndAfter() throws RedPenException { Document document = prepareSimpleDocument("I like 1*10."); Configuration config = Configuration.builder() .addValidatorConfig(new ValidatorConfiguration("SymbolWithSpace")) .addSymbol(new Symbol(ASTERISK, '*', "", true, true)) .build(); RedPen redPen = new RedPen(config); Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document)); assertEquals(1, errors.get(document).size()); assertEquals("Need whitespace before and after symbol \"*\".", errors.get(document).get(0).getMessage()); }
@Override public void validate(Sentence sentence) { Set<SymbolType> symbolTypes = getSymbolTable().getNames(); for (SymbolType symbolType : symbolTypes) { validateSymbol(sentence, symbolType); } }
SymbolWithSpaceValidator extends Validator { @Override public void validate(Sentence sentence) { Set<SymbolType> symbolTypes = getSymbolTable().getNames(); for (SymbolType symbolType : symbolTypes) { validateSymbol(sentence, symbolType); } } }
SymbolWithSpaceValidator extends Validator { @Override public void validate(Sentence sentence) { Set<SymbolType> symbolTypes = getSymbolTable().getNames(); for (SymbolType symbolType : symbolTypes) { validateSymbol(sentence, symbolType); } }  }
SymbolWithSpaceValidator extends Validator { @Override public void validate(Sentence sentence) { Set<SymbolType> symbolTypes = getSymbolTable().getNames(); for (SymbolType symbolType : symbolTypes) { validateSymbol(sentence, symbolType); } }  @Override void validate(Sentence sentence); }
SymbolWithSpaceValidator extends Validator { @Override public void validate(Sentence sentence) { Set<SymbolType> symbolTypes = getSymbolTable().getNames(); for (SymbolType symbolType : symbolTypes) { validateSymbol(sentence, symbolType); } }  @Override void validate(Sentence sentence);  }