Skip to content

Commit

Permalink
#144 Fixed that whitespace in linkReplacement was not stripped (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobbraun authored Jun 21, 2021
1 parent 46c30fd commit 3a06d85
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/changes/changes_0.8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Code name:

* #20: Added requirements and design

## Bug Fixes:

* #144 Fixed that whitespace in linkReplacement was not stripped

## Dependency Updates

### Plugin Dependency Updates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private void readReplacementParameter(final List<String> replacementParameters)
for (final String replacementParameter : replacementParameters) {
final String[] parts = replacementParameter.split("\\|");
checkSyntax(replacementParameter, parts);
this.replacements.put(parts[0].toLowerCase(), parts[1]);
this.replacements.put(parts[0].toLowerCase().trim(), parts[1].trim());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ void testReplaceParameters() {
assertThat(replacer.replaceIfBroken("http://exxxample.com"), equalTo("http://example.com"));
}

@Test
void testReplaceParametersWithWhitespace() {
final BrokenLinkReplacer replacer = new BrokenLinkReplacer(
List.of("\n http://exxxample.com|http://example.com\n "));
assertThat(replacer.replaceIfBroken("http://exxxample.com"), equalTo("http://example.com"));
}

@Test
void testInvalidSyntax() {
final List<String> replacementParameters = List.of("http://exxxample.com");
Expand Down

0 comments on commit 3a06d85

Please sign in to comment.