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

[Misc] Apply test best practices

parent 2050f822
No related branches found
No related tags found
No related merge requests found
...@@ -58,8 +58,7 @@ public class DefaultContentParserTest ...@@ -58,8 +58,7 @@ public class DefaultContentParserTest
{ {
@Rule @Rule
public final MockitoComponentMockingRule<ContentParser> mocker = public final MockitoComponentMockingRule<ContentParser> mocker =
new MockitoComponentMockingRule<ContentParser>(DefaultContentParser.class); new MockitoComponentMockingRule<>(DefaultContentParser.class);
@Rule @Rule
public ExpectedException thrown = ExpectedException.none(); public ExpectedException thrown = ExpectedException.none();
...@@ -78,7 +77,7 @@ public void configure() throws Exception ...@@ -78,7 +77,7 @@ public void configure() throws Exception
} }
@Test @Test
public void testNoMetadataSource() throws Exception public void parseHasNoMetadataSource() throws Exception
{ {
XDOM xdom = mocker.getComponentUnderTest().parse("", Syntax.PLAIN_1_0); XDOM xdom = mocker.getComponentUnderTest().parse("", Syntax.PLAIN_1_0);
...@@ -86,15 +85,15 @@ public void testNoMetadataSource() throws Exception ...@@ -86,15 +85,15 @@ public void testNoMetadataSource() throws Exception
} }
@Test @Test
public void testAddingMetadataSource() throws Exception public void parseIsAddingMetadataSource() throws Exception
{ {
XDOM xdom = mocker.getComponentUnderTest().parse("", Syntax.PLAIN_1_0, DOCUMENT_REFERENCE); XDOM xdom = mocker.getComponentUnderTest().parse("", Syntax.PLAIN_1_0, DOCUMENT_REFERENCE);
assertThat((String) xdom.getMetaData().getMetaData(MetaData.SOURCE), equalTo(SOURCE)); assertThat(xdom.getMetaData().getMetaData(MetaData.SOURCE), equalTo(SOURCE));
} }
@Test @Test
public void testMissingParserException() throws Exception public void parseWhenNoParser() throws Exception
{ {
thrown.expect(MissingParserException.class); thrown.expect(MissingParserException.class);
thrown.expectMessage("Failed to find a parser for syntax [XWiki 2.1]"); thrown.expectMessage("Failed to find a parser for syntax [XWiki 2.1]");
......
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