From 4d5ed597d80f8e0a070b52e1c673d14e3597e9e8 Mon Sep 17 00:00:00 2001 From: Godin Date: Mon, 1 Nov 2010 16:12:30 +0000 Subject: SONAR-1897: Add web service to get information about installed plugins --- .../sonar/wsclient/services/PluginQueryTest.java | 16 ++++++++++++++++ .../unmarshallers/PluginUnmarshallerTest.java | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java create mode 100644 sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java (limited to 'sonar-ws-client/src/test') diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java new file mode 100644 index 00000000000..49d226852ee --- /dev/null +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PluginQueryTest.java @@ -0,0 +1,16 @@ +package org.sonar.wsclient.services; + +import org.junit.Test; + +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertThat; + +public class PluginQueryTest { + + @Test + public void index() { + PluginQuery query = new PluginQuery(); + assertThat(query.getUrl(), is("/api/plugins")); + } + +} diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java new file mode 100644 index 00000000000..615407b15b1 --- /dev/null +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PluginUnmarshallerTest.java @@ -0,0 +1,22 @@ +package org.sonar.wsclient.unmarshallers; + +import org.junit.Test; +import org.sonar.wsclient.services.Plugin; + +import java.util.List; + +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertThat; + +public class PluginUnmarshallerTest { + + @Test + public void toModel() throws Exception { + List plugins = new PluginUnmarshaller().toModels("[{\"key\": \"foo\", \"name\": \"Foo\", \"version\": \"1.0\"}]"); + Plugin plugin = plugins.get(0); + assertThat(plugin.getKey(), is("foo")); + assertThat(plugin.getName(), is("Foo")); + assertThat(plugin.getVersion(), is("1.0")); + } + +} -- cgit v1.2.3