Skip to content
Snippets Groups Projects
Commit 99ce6469 authored by Vincent Massol's avatar Vincent Massol
Browse files

[Misc] Protect against null content (fix TPC)

parent c1912512
No related branches found
No related tags found
No related merge requests found
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
import static org.hamcrest.CoreMatchers.any; import static org.hamcrest.CoreMatchers.any;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.mockito.hamcrest.MockitoHamcrest.argThat; import static org.mockito.hamcrest.MockitoHamcrest.argThat;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
...@@ -100,4 +101,11 @@ public void parseWhenNoParser() throws Exception ...@@ -100,4 +101,11 @@ public void parseWhenNoParser() throws Exception
thrown.expectCause(any(ComponentLookupException.class)); thrown.expectCause(any(ComponentLookupException.class));
mocker.getComponentUnderTest().parse("", Syntax.XWIKI_2_1, DOCUMENT_REFERENCE); mocker.getComponentUnderTest().parse("", Syntax.XWIKI_2_1, DOCUMENT_REFERENCE);
} }
@Test
public void parseWhenNullSource() throws Exception
{
XDOM xdom = mocker.getComponentUnderTest().parse(null, Syntax.PLAIN_1_0);
assertEquals(0, xdom.getChildren().size());
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment