|
14 | 14 | import java.util.*;
|
15 | 15 |
|
16 | 16 | import static main.model.db.imports.ResultStatus.*;
|
| 17 | +import static main.model.db.imports.TestNameNodeType.*; |
17 | 18 |
|
18 | 19 | public class NUnitV3Handler extends Handler {
|
19 | 20 | private TestSuiteDto testSuite = new TestSuiteDto();
|
@@ -62,7 +63,7 @@ public void startElement(String uri, String localName, String qName, Attributes
|
62 | 63 | testRun.setAuthor(String.format("%s\\%s", attributes.getValue("user-domain"), attributes.getValue("user")));
|
63 | 64 | break;
|
64 | 65 | case "test-suite":
|
65 |
| - if(attributes.getValue("type").equals("TestFixture") && testNameNodeType == TestNameNodeType.featureNameTestName) { |
| 66 | + if(attributes.getValue("type").equals("TestFixture") && testNameNodeType == featureNameTestName) { |
66 | 67 | currentFixture = attributes.getValue("name");
|
67 | 68 | }
|
68 | 69 | break;
|
@@ -170,13 +171,15 @@ public void characters(char[] ch, int start, int length) {
|
170 | 171 | }
|
171 | 172 |
|
172 | 173 | private void setTestName(Attributes attributes) throws SAXException {
|
173 |
| - if(testNameNodeType == TestNameNodeType.featureNameTestName) { |
174 |
| - test.setName(String.format("%s: %s", currentFixture, attributes.getValue("name")) ); |
175 |
| - } |
176 |
| - else if(testNameNodeType == TestNameNodeType.className) { |
177 |
| - test.setName(attributes.getValue("fullname")); |
178 |
| - } else { |
179 |
| - throw new SAXException("testNameNodeType is not correct for NUnitV3 parser."); |
| 174 | + switch (testNameNodeType) { |
| 175 | + case featureNameTestName: |
| 176 | + test.setName(String.format("%s: %s", currentFixture, attributes.getValue("name")) ); |
| 177 | + break; |
| 178 | + case className: |
| 179 | + test.setName(attributes.getValue("fullname")); |
| 180 | + break; |
| 181 | + default: |
| 182 | + throw new SAXException("testNameNodeType is not correct for NUnitV3 parser."); |
180 | 183 | }
|
181 | 184 | }
|
182 | 185 |
|
|
0 commit comments