diff options
author | Godin <mandrikov@gmail.com> | 2010-12-01 13:19:46 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-12-01 13:19:46 +0000 |
commit | 0ec9be1302badbb39c4d9e6d9166584aabab914d (patch) | |
tree | e6c41bf8c04fb854dbb9fb99ace46521830178e9 /sonar-ws-client/src/test | |
parent | 36c05bb83f2221a55d5df2d2a04de6f597d70528 (diff) | |
download | sonarqube-0ec9be1302badbb39c4d9e6d9166584aabab914d.tar.gz sonarqube-0ec9be1302badbb39c4d9e6d9166584aabab914d.zip |
SONAR-1450:
* Expose rule_failure.created_at in rest api
* Support createdAt in sonar-ws-client
Diffstat (limited to 'sonar-ws-client/src/test')
-rw-r--r-- | sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ViolationUnmarshallerTest.java | 16 | ||||
-rw-r--r-- | sonar-ws-client/src/test/resources/violations/violations.json | 4 |
2 files changed, 12 insertions, 8 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 ff879b6ebaf..7eb1e1aaf7b 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,6 +19,12 @@ */ package org.sonar.wsclient.unmarshallers; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.core.IsNot.not; +import static org.junit.Assert.assertThat; + import org.apache.commons.io.IOUtils; import org.junit.Test; import org.sonar.wsclient.services.Violation; @@ -26,11 +32,6 @@ import org.sonar.wsclient.services.Violation; import java.io.IOException; import java.util.List; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.core.IsNot.not; -import static org.junit.Assert.assertThat; - public class ViolationUnmarshallerTest { @Test @@ -44,10 +45,12 @@ public class ViolationUnmarshallerTest { violation = violations.get(0); assertThat(violation.getMessage(), is("throw java.lang.Exception")); assertThat(violation.getLine(), is(97)); + assertThat(violation.getCreatedAt(), notNullValue()); assertThat(violation.getPriority(), is("MAJOR")); assertThat(violation.getRuleKey(), is("pmd:SignatureDeclareThrowsException")); assertThat(violation.getRuleName(), is("Signature Declare Throws Exception")); - assertThat(violation.getResourceKey(), is("org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool")); + assertThat(violation.getResourceKey(), + is("org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool")); assertThat(violation.getResourceName(), is("TraceableResourceLimitingPool")); assertThat(violation.getResourceQualifier(), is("CLA")); assertThat(violation.getResourceScope(), is("FIL")); @@ -58,6 +61,7 @@ public class ViolationUnmarshallerTest { Violation violation = new ViolationUnmarshaller().toModel(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 { diff --git a/sonar-ws-client/src/test/resources/violations/violations.json b/sonar-ws-client/src/test/resources/violations/violations.json index ec9fb7b682a..92c98b332f0 100644 --- a/sonar-ws-client/src/test/resources/violations/violations.json +++ b/sonar-ws-client/src/test/resources/violations/violations.json @@ -1,4 +1,4 @@ [ - {"message":"throw java.lang.Exception","line":97,"priority":"MAJOR","rule":{"key":"pmd:SignatureDeclareThrowsException","name":"Signature Declare Throws Exception","category":"Maintainability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}}, - {"message":"The user-supplied array 'threads' is stored directly.","line":242,"priority":"MAJOR","rule":{"key":"pmd:ArrayIsStoredDirectly","name":"Security - Array is stored directly","category":"Reliability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}} + {"message":"throw java.lang.Exception","line":97,"createdAt":"2010-12-01T13:55:22+0300","priority":"MAJOR","rule":{"key":"pmd:SignatureDeclareThrowsException","name":"Signature Declare Throws Exception","category":"Maintainability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}}, + {"message":"The user-supplied array 'threads' is stored directly.","line":242,"createdAt":"2010-12-01T13:55:22+0300","priority":"MAJOR","rule":{"key":"pmd:ArrayIsStoredDirectly","name":"Security - Array is stored directly","category":"Reliability"},"resource":{"key":"org.apache.excalibur.components:excalibur-pool-instrumented:org.apache.avalon.excalibur.pool.TraceableResourceLimitingPool","name":"TraceableResourceLimitingPool","scope":"FIL","qualifier":"CLA","language":"java"}} ]
\ No newline at end of file |