Clover icon

java-junit-xml-merger 1.0.1

  1. Project Clover database Mi Okt 4 2017 15:38:24 MESZ
  2. Package io.codeclou.java.junit.xml.merger.model

File TestSuitesTest.java

 

Code metrics

0
14
2
1
56
28
2
0,14
7
2
1

Classes

Class Line # Actions
TestSuitesTest 33 14 0% 2 0
1.0100%
 

Contributing tests

This file is covered by 2 tests. .

Source view

1    /*
2    * MIT License
3    *
4    * Copyright (c) 2017 Bernhard Grünewaldt
5    *
6    * Permission is hereby granted, free of charge, to any person obtaining a copy
7    * of this software and associated documentation files (the "Software"), to deal
8    * in the Software without restriction, including without limitation the rights
9    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10    * copies of the Software, and to permit persons to whom the Software is
11    * furnished to do so, subject to the following conditions:
12    *
13    * The above copyright notice and this permission notice shall be included in all
14    * copies or substantial portions of the Software.
15    *
16    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17    * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18    * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19    * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21    * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22    * SOFTWARE.
23    */
24    package io.codeclou.java.junit.xml.merger.model;
25   
26    import io.codeclou.java.junit.xml.merger.GetterSetterValidator;
27    import io.codeclou.java.junit.xml.merger.JunitXmlParser;
28    import org.junit.Test;
29    import org.w3c.dom.Document;
30   
31    import static org.junit.Assert.assertEquals;
32   
 
33    public class TestSuitesTest {
 
34  1 toggle @Test
35    public void testPojoGetterSetter() {
36  1 GetterSetterValidator.validateAccessors(TestSuites.class);
37    }
38   
 
39  1 toggle @Test
40    public void testToXml() throws Exception {
41  1 JunitXmlParser jxml = new JunitXmlParser();
42  1 TestSuite suite1 = jxml.transform(XmlHelper.xmlFromString("<testsuite name='foo' time='4.20' errors='1' tests='3' failures='5' skipped='2'></testsuite>".replaceAll("'", "\"")));
43  1 TestSuite suite2 = jxml.transform(XmlHelper.xmlFromString("<testsuite name='bar' time='21.01' errors='2' tests='4' failures='3' skipped='6'></testsuite>".replaceAll("'", "\"")));
44  1 TestSuites suites = new TestSuites();
45  1 suites.setName("foobar23");
46  1 suites.getTestSuites().add(suite1);
47  1 suites.getTestSuites().add(suite2);
48  1 assertEquals(suites.getFailures(), new Long(8L));
49  1 assertEquals(suites.getTests(), new Long(7L));
50  1 assertEquals(suites.getName(), "foobar23");
51  1 assertEquals(suites.getTime(), new Double(25.21));
52   
53  1 Document d = suites.toXml();
54  1 assertEquals(d.getFirstChild().getAttributes().getNamedItem("failures").getNodeValue(), "8");
55    }
56    }