@Test void testApplyReplacing() { ReplacingService replacingService = new ReplacingServiceImpl(); assertEquals( " 05\n\r. .CHILD201\r\n.", replacingService.applyReplacing( " 01\n\r. .CHILD101\r\n.", List.of( Pair.of("(?<=[\\.\\s\\r\\n])01(?=[\\.\\s\\r\\n])", "05"), Pair.of("CHILD1", "CHILD2")))); assertEquals("01 ABC.", replacingService.applyReplacing("01 ABC.", List.of(Pair.of("", "")))); }
@Nonnull public String applyReplacing( @Nonnull String text, @Nonnull List<Pair<String, String>> replacePatterns) { return replacePatterns.stream().reduce(text, this::replace, (str1, str2) -> str2); }
ReplacingServiceImpl implements ReplacingService { @Nonnull public String applyReplacing( @Nonnull String text, @Nonnull List<Pair<String, String>> replacePatterns) { return replacePatterns.stream().reduce(text, this::replace, (str1, str2) -> str2); } }
ReplacingServiceImpl implements ReplacingService { @Nonnull public String applyReplacing( @Nonnull String text, @Nonnull List<Pair<String, String>> replacePatterns) { return replacePatterns.stream().reduce(text, this::replace, (str1, str2) -> str2); }  }
ReplacingServiceImpl implements ReplacingService { @Nonnull public String applyReplacing( @Nonnull String text, @Nonnull List<Pair<String, String>> replacePatterns) { return replacePatterns.stream().reduce(text, this::replace, (str1, str2) -> str2); }  @Nonnull String applyReplacing(
      @Nonnull String text, @Nonnull List<Pair<String, String>> replacePatterns); @Nonnull @Override Pair<String, String> retrievePseudoTextReplacingPattern(@Nonnull String clause); @Nonnull @Override Pair<String, String> retrieveTokenReplacingPattern(@Nonnull String clause); }
ReplacingServiceImpl implements ReplacingService { @Nonnull public String applyReplacing( @Nonnull String text, @Nonnull List<Pair<String, String>> replacePatterns) { return replacePatterns.stream().reduce(text, this::replace, (str1, str2) -> str2); }  @Nonnull String applyReplacing(
      @Nonnull String text, @Nonnull List<Pair<String, String>> replacePatterns); @Nonnull @Override Pair<String, String> retrievePseudoTextReplacingPattern(@Nonnull String clause); @Nonnull @Override Pair<String, String> retrieveTokenReplacingPattern(@Nonnull String clause);  }