Java Code Examples for org.sonar.api.utils.Version#create()

The following examples show how to use org.sonar.api.utils.Version#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PluginTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_get_the_right_version() {
  Context context = new Context(Version.create(5, 6));
  new Plugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
Example 2
Source File: RubyPluginTest.java    From sonar-ruby-plugin with MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Test
public void testDefine() {
    RubyPlugin plugin = new RubyPlugin();

    Plugin.Context context = new Plugin.Context(Version.create(1, 0));

    plugin.define(context);

    assertThat(context.getExtensions().size()).isEqualTo(18);

    assertThat(context.getExtensions().stream().filter(ext -> ext instanceof PropertyDefinition).count()).isEqualTo(7);
    assertThat(context.getExtensions().stream().filter(ext -> ext instanceof Class).count()).isEqualTo(11);
}
 
Example 3
Source File: MyGherkinCustomRulesPluginTest.java    From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_get_the_right_version() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new MyGherkinCustomRulesPlugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
Example 4
Source File: GherkinPluginTest.java    From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void should_get_the_right_version() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new GherkinPlugin().define(context);
  assertThat(context.getSonarQubeVersion().major()).isEqualTo(5);
  assertThat(context.getSonarQubeVersion().minor()).isEqualTo(6);
}
 
Example 5
Source File: PluginTest.java    From sonar-css-plugin with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Test
public void should_get_the_right_number_of_extensions() {
  Context context = new Context(Version.create(5, 6));
  new Plugin().define(context);
  assertThat(context.getExtensions()).hasSize(13);
}
 
Example 6
Source File: MyGherkinCustomRulesPluginTest.java    From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Test
public void should_get_the_right_number_of_extensions() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new MyGherkinCustomRulesPlugin().define(context);
  assertThat(context.getExtensions()).hasSize(1);
}
 
Example 7
Source File: GherkinPluginTest.java    From sonar-gherkin-plugin with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Test
public void should_get_the_right_number_of_extensions() {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new GherkinPlugin().define(context);
  assertThat(context.getExtensions()).hasSize(4);
}
 
Example 8
Source File: LuaPluginTest.java    From sonar-lua with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Test
public void testGetExtensions() throws Exception {
  Plugin.Context context = new Plugin.Context(Version.create(5, 6));
  new LuaPlugin().define(context);
  assertThat(context.getExtensions()).isNotEmpty();
}