diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-07-18 12:18:39 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-07-18 15:43:39 +0200 |
commit | c3174fada2ab193d03661209bee3291772b8f347 (patch) | |
tree | 2c421a541d108f24bbab0c861c6ab9aaedfa7bdc /sonar-batch-protocol/src/test | |
parent | 274e9cefeb16fab1d5e35088289338f12993b208 (diff) | |
download | sonarqube-c3174fada2ab193d03661209bee3291772b8f347.tar.gz sonarqube-c3174fada2ab193d03661209bee3291772b8f347.zip |
SONAR-5417 Get active rules using batch protocol
Diffstat (limited to 'sonar-batch-protocol/src/test')
-rw-r--r-- | sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java index e4d5142f10d..cb5bc33d23e 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java @@ -24,23 +24,32 @@ import org.junit.Test; import org.skyscreamer.jsonassert.JSONAssert; import java.io.StringReader; +import java.text.SimpleDateFormat; import static org.fest.assertions.Assertions.assertThat; public class ProjectReferentialsTest { @Test - public void testToJson() throws JSONException { + public void testToJson() throws Exception { ProjectReferentials ref = new ProjectReferentials(); ref.metrics().add(new Metric("ncloc", "INT")); + ref.addQProfile(new QProfile("squid-java", "Java", "java", new SimpleDateFormat("dd/MM/yyyy").parse("14/03/1984"))); System.out.println(ref.toJson()); - JSONAssert.assertEquals("{timestamp:0,languages:[],metrics:[{key:ncloc,valueType:INT}]}", ref.toJson(), true); + JSONAssert + .assertEquals( + "{timestamp:0,metrics:[{key:ncloc,valueType:INT}]," + + "qprofilesByLanguage:{java:{key:\"squid-java\"," + + "name:Java," + + "language:java,rulesUpdatedAt:\"Mar 14, 1984 12:00:00 AM\"}}," + + "activeRules:[]}", + ref.toJson(), true); } @Test public void testFromJson() throws JSONException { - ProjectReferentials ref = ProjectReferentials.fromJson(new StringReader("{timestamp:1,languages:[],metrics:[{key:ncloc,valueType:INT}]}")); + ProjectReferentials ref = ProjectReferentials.fromJson(new StringReader("{timestamp:1,metrics:[{key:ncloc,valueType:INT}]}")); assertThat(ref.timestamp()).isEqualTo(1); Metric metric = ref.metrics().iterator().next(); |