diff options
Diffstat (limited to 'sonar-ws-client/src/test')
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java | 25 | ||||
-rw-r--r-- | sonar-ws-client/src/test/resources/timemachine/timemachine.json | 4 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java new file mode 100644 index 00000000000..e722c1120ad --- /dev/null +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/TimeMachineUnmarshallerTest.java @@ -0,0 +1,25 @@ +package org.sonar.wsclient.unmarshallers; + +import org.apache.commons.io.IOUtils; +import org.junit.Test; +import org.sonar.wsclient.services.TimeMachineData; + +import java.io.IOException; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class TimeMachineUnmarshallerTest { + + @Test + public void toModel() throws IOException { + TimeMachineData data = new TimeMachineUnmarshaller().toModel(loadFile("/timemachine/timemachine.json")); + + assertThat(data.getData().size(), is(2)); + } + + private static String loadFile(String path) throws IOException { + return IOUtils.toString(TimeMachineUnmarshallerTest.class.getResourceAsStream(path)); + } + +} diff --git a/sonar-ws-client/src/test/resources/timemachine/timemachine.json b/sonar-ws-client/src/test/resources/timemachine/timemachine.json new file mode 100644 index 00000000000..e4777958df8 --- /dev/null +++ b/sonar-ws-client/src/test/resources/timemachine/timemachine.json @@ -0,0 +1,4 @@ +{ + "2010-10-04T00:00:00+0000": ["18.0", null, "13.1"], + "2010-12-04T00:00:00+0000": ["20.0", null, "12.8"] +} |