diff options
Diffstat (limited to 'sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java')
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java index 4f2feefd4a5..22e256dc73b 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java @@ -19,11 +19,9 @@ */ package org.sonar.wsclient.unmarshallers; -import org.apache.commons.io.IOUtils; import org.junit.Test; import org.sonar.wsclient.services.Violation; -import java.io.IOException; import java.util.List; import static org.hamcrest.CoreMatchers.is; @@ -35,11 +33,11 @@ import static org.junit.Assert.assertThat; public class ViolationUnmarshallerTest { @Test - public void toModels() throws IOException { + public void toModels() { Violation violation = new ViolationUnmarshaller().toModel("[]"); assertThat(violation, nullValue()); - List<Violation> violations = new ViolationUnmarshaller().toModels(loadFile("/violations/violations.json")); + List<Violation> violations = new ViolationUnmarshaller().toModels(WSTestUtils.loadFile("/violations/violations.json")); assertThat(violations.size(), is(2)); violation = violations.get(0); @@ -57,15 +55,11 @@ public class ViolationUnmarshallerTest { } @Test - public void violationWithoutLineNumber() throws IOException { - Violation violation = new ViolationUnmarshaller().toModel(loadFile("/violations/violation-without-optional-fields.json")); + public void violationWithoutLineNumber() { + Violation violation = new ViolationUnmarshaller().toModel(WSTestUtils.loadFile("/violations/violation-without-optional-fields.json")); assertThat(violation.getMessage(), not(nullValue())); assertThat(violation.getLine(), nullValue()); assertThat(violation.getCreatedAt(), nullValue()); } - private static String loadFile(String path) throws IOException { - return IOUtils.toString(MetricUnmarshallerTest.class.getResourceAsStream(path)); - } - } |