|
link = link.substring(0, link.indexOf(" ", openParen)); |
The value stored in link from the first time substring() is called gets overwritten by the second time substring() is called, making the first call to the method redundant.
To fix, add an else block around the second substring(), or add a trim() to link.
A test that breaks is:
[hello](world.com) <-- There are spaces
1) testGetLinks_testFile10(MarkdownParseTest)
java.lang.AssertionError: Validate MarkdownParse on test-file10.md expected:<[world.com]> but was:<[]>
at org.junit.Assert.fail(Assert.java:89)
at org.junit.Assert.failNotEquals(Assert.java:835)
at org.junit.Assert.assertEquals(Assert.java:120)
at MarkdownParseTest.testGetLinks_testFile10(MarkdownParseTest.java:183)
FAILURES!!!
Tests run: 22, Failures: 1
markdown-parse/MarkdownParse.java
Line 22 in 34a4c89
The value stored in
linkfrom the first timesubstring()is called gets overwritten by the second timesubstring()is called, making the first call to the method redundant.To fix, add an
elseblock around the secondsubstring(), or add atrim()tolink.A test that breaks is: