Skip to content

Commit 00618ca

Browse files
author
jberque
committed
make the test method throws exceptions ,
if the file is not found in the project, the test will fail showing the FileNotFoundException
1 parent 23c15af commit 00618ca

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

android-plugin/src/test/java/org/sonar/plugins/groovy/GroovySonarWayProfileTest.java

+6-10
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
public class GroovySonarWayProfileTest {
4444

4545
@Test
46-
public void shouldCreateSonarWayProfile() {
46+
public void shouldCreateSonarWayProfile() throws ParserConfigurationException, IOException, SAXException {
4747
ValidationMessages messages = ValidationMessages.create();
4848

4949
GroovySonarWayProfile profileDef = new GroovySonarWayProfile();
@@ -57,15 +57,11 @@ public void shouldCreateSonarWayProfile() {
5757
File profile_default = new File("src/main/resources/org/sonar/plugins/groovy/rules.xml");
5858
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
5959
DocumentBuilder db;
60-
try {
61-
db = dbf.newDocumentBuilder();
62-
Document doc = db.parse(profile_default);
63-
doc.getDocumentElement().normalize();
64-
NodeList rule = doc.getElementsByTagName("rule");
65-
assertThat(activeRules).as("Expected number of rules in profile").hasSize(rule.getLength());
66-
} catch (ParserConfigurationException | SAXException | IOException e) {
67-
e.printStackTrace();
68-
}
60+
db = dbf.newDocumentBuilder();
61+
Document doc = db.parse(profile_default);
62+
doc.getDocumentElement().normalize();
63+
NodeList ruleList = doc.getElementsByTagName("rule");
64+
assertThat(activeRules).as("Expected number of rules in profile").hasSize(ruleList.getLength());
6965
assertThat(profile.name()).isEqualTo(Groovy.PROFILE_NAME);
7066

7167
// Check that we use severity from the read rule and not default one.

0 commit comments

Comments
 (0)