Skip to content

Commit 7aeffb7

Browse files
committed
fix(test): improve assertions
1 parent d6d7985 commit 7aeffb7

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

src/test/java/io/codeclou/java/junit/xml/merger/JunitXmlParserTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
import org.mockito.internal.util.reflection.Whitebox;
2929

3030
import java.io.File;
31+
import java.util.ArrayList;
3132
import java.util.Collection;
33+
import java.util.List;
3234

3335
import static junit.framework.TestCase.assertFalse;
3436
import static org.junit.Assert.*;
@@ -42,9 +44,16 @@ private File getTestFile(String filename) {
4244

4345
@Test
4446
public void testParseSuites() throws Exception {
47+
// GIVEN
4548
JunitXmlParser parser = new JunitXmlParser();
49+
// WHEN
4650
Collection<TestSuite> c = parser.parseTestSuites(getTestFile("testsuites.xml"));
51+
List<TestSuite> l = new ArrayList<>(c);
52+
// THEN
4753
assertFalse(c.isEmpty());
54+
assertEquals(2, c.size());
55+
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");
4857
}
4958

5059
@Test

src/test/resources/testsuites.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<testsuites>
3-
<testsuite tests="3" failures="0" name="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" time="0.029" errors="0" skipped="0">
3+
<testsuite tests="3" failures="0" name="ut.io.codeclou.customfield.editor.model.rest.SortModelTestOne" time="0.029" errors="0" skipped="0">
44
<testcase classname="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" name="testIsValid" time="0"/>
55
<testcase classname="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" name="testToSortCollator" time="0.029"/>
66
<testcase classname="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" name="testIsDescending" time="0"/>
77
</testsuite>
8-
<testsuite tests="3" failures="0" name="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" time="0.029" errors="0" skipped="0">
8+
<testsuite tests="3" failures="0" name="ut.io.codeclou.customfield.editor.model.rest.SortModelTestTwo" time="0.029" errors="0" skipped="0">
99
<testcase classname="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" name="testIsValid" time="0"/>
1010
<testcase classname="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" name="testToSortCollator" time="0.029"/>
1111
<testcase classname="ut.io.codeclou.customfield.editor.model.rest.SortModelTest" name="testIsDescending" time="0"/>

0 commit comments

Comments
 (0)