ProcessingTokenizerDecorator implements ITokenizer { @Override public String[] tokenize(String input) { final String preprocessed_input = preprocessor.process(input); final String[] tokenized_input = tokenizer.tokenize(preprocessed_input); return Arrays.asList(tokenized_input) .stream().map(s -> postprocessor.process(s)) .toArray(String[]::new); } ProcessingTokenizerDecorator(ITokenizer tokenizer, StringPostprocessor postprocessor);  ProcessingTokenizerDecorator(ITokenizer tokenizer, StringPreprocessor preprocessor);  ProcessingTokenizerDecorator(ITokenizer tokenizer, StringPreprocessor preprocessor, StringPostprocessor postprocessor); @Override String[] tokenize(String input);  }
@Test public void testFixedLengthTokenizer_TokenizeLine() { List<ColumnDefinition> columnDefinition = new ArrayList<>(); columnDefinition.add(new ColumnDefinition(0, 10)); columnDefinition.add(new ColumnDefinition(10, 20)); String input = " Philipp Wagner "; ITokenizer tokenizer = new FixedLengthTokenizer(columnDefinition); StringPreprocessor preprocessor = new StringPreprocessor(s -> s.toUpperCase()); StringPostprocessor postprocessor = new StringPostprocessor(s -> s.trim()); ITokenizer decoratedTokenizer = new ProcessingTokenizerDecorator(tokenizer, preprocessor, postprocessor); String[] result = decoratedTokenizer.tokenize(input); Assert.assertNotNull(result); Assert.assertEquals(2, result.length); Assert.assertEquals("PHILIPP", result[0]); Assert.assertEquals("WAGNER", result[1]); }