2323 */
2424package io .codeclou .java .junit .xml .merger ;
2525
26- import io .codeclou .java .junit .xml .merger .model .TestSuite ;
27- import org .junit .Test ;
28- import org .mockito .internal .util .reflection .Whitebox ;
26+ import static junit .framework .TestCase .assertFalse ;
27+ import static org .junit .Assert .*;
2928
29+ import io .codeclou .java .junit .xml .merger .model .TestSuite ;
3030import java .io .File ;
3131import java .util .ArrayList ;
3232import java .util .Collection ;
3333import java .util .List ;
34-
35- import static junit .framework .TestCase .assertFalse ;
36- import static org .junit .Assert .*;
34+ import org .junit .Test ;
35+ import org .mockito .internal .util .reflection .Whitebox ;
3736
3837public class JunitXmlParserTest {
3938
@@ -53,7 +52,7 @@ public void testParseSuites() throws Exception {
5352 assertFalse (c .isEmpty ());
5453 assertEquals (2 , c .size ());
5554 assertEquals (l .get (0 ).getName (), "ut.io.codeclou.customfield.editor.model.rest.SortModelTestOne" );
56- assertEquals (l .get (1 ). getName (), "ut.io.codeclou.customfield.editor.model.rest.SortModelTestTwo" );
55+ assertEquals (l .get (1 ).getName (), "ut.io.codeclou.customfield.editor.model.rest.SortModelTestTwo" );
5756 }
5857
5958 @ Test
@@ -93,7 +92,7 @@ public void testRunInvalidInput1() throws Exception {
9392
9493 @ Test
9594 public void testRunInvalidInput2 () throws Exception {
96- String [] args = {"-i=foo" };
95+ String [] args = { "-i=foo" };
9796 JunitXmlParser parser = new JunitXmlParser ();
9897 parser .run (args );
9998 Boolean hasCmdLineParameterErrors = (Boolean ) Whitebox .getInternalState (parser , "hasCmdLineParameterErrors" );
@@ -102,16 +101,28 @@ public void testRunInvalidInput2() throws Exception {
102101
103102 @ Test
104103 public void testRunInvalidInput3 () throws Exception {
105- String [] args = {"-i=foo" , "-o=bar.xml" };
104+ String [] args = { "-i=foo" , "-o=bar.xml" };
106105 JunitXmlParser parser = new JunitXmlParser ();
107106 parser .run (args );
108107 Boolean hasCmdLineParameterErrors = (Boolean ) Whitebox .getInternalState (parser , "hasCmdLineParameterErrors" );
109108 assertTrue (hasCmdLineParameterErrors );
110109 }
111110
111+ @ Test
112+ public void testRunInvalidXmlFiles () throws Exception {
113+ // GIVEN
114+ String [] args = { "-i=src/test/resources/invalid-files/" , "-o=bar.xml" , "-s=foo bar" };
115+ JunitXmlParser parser = new JunitXmlParser ();
116+ // WHEN
117+ parser .run (args );
118+ // THEN
119+ Boolean hasCmdLineParameterErrors = (Boolean ) Whitebox .getInternalState (parser , "hasCmdLineParameterErrors" );
120+ assertFalse (hasCmdLineParameterErrors );
121+ }
122+
112123 @ Test
113124 public void testRunValidInputWithInvalidFolders () throws Exception {
114- String [] args = {"-i=foo" , "-o=?x/bar.xml" , "-s=foo" };
125+ String [] args = { "-i=foo" , "-o=?x/bar.xml" , "-s=foo" };
115126 JunitXmlParser parser = new JunitXmlParser ();
116127 parser .run (args );
117128 Boolean hasFileNotFoundErrors = (Boolean ) Whitebox .getInternalState (parser , "hasFileNotFoundErrors" );
@@ -120,7 +131,7 @@ public void testRunValidInputWithInvalidFolders() throws Exception {
120131
121132 @ Test
122133 public void testRunValidInputWithValidFolders () throws Exception {
123- String [] args = {"-i=src/test/resources/" , "-o=output.xml" , "-s=foo bar" };
134+ String [] args = { "-i=src/test/resources/" , "-o=output.xml" , "-s=foo bar" };
124135 JunitXmlParser parser = new JunitXmlParser ();
125136 parser .run (args );
126137 Boolean hasCmdLineParameterErrors = (Boolean ) Whitebox .getInternalState (parser , "hasCmdLineParameterErrors" );
@@ -133,7 +144,7 @@ public void testRunValidInputWithValidFolders() throws Exception {
133144 public void testRunValidInputWithEmptyInputFolder () throws Exception {
134145 File emptyDir = new File ("src/test/resources/empty/" );
135146 emptyDir .mkdir ();
136- String [] args = {"-i=src/test/resources/empty/" , "-o=output.xml" , "-s=foo bar" };
147+ String [] args = { "-i=src/test/resources/empty/" , "-o=output.xml" , "-s=foo bar" };
137148 JunitXmlParser parser = new JunitXmlParser ();
138149 parser .run (args );
139150 Boolean hasCmdLineParameterErrors = (Boolean ) Whitebox .getInternalState (parser , "hasCmdLineParameterErrors" );
0 commit comments