diff options
author | Jacek <jacek.poreda@sonarsource.com> | 2022-05-30 18:50:42 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-05-31 20:02:50 +0000 |
commit | 9097b10693f9c4fe2c7bde4bccdbca151ebfa452 (patch) | |
tree | 10eb71dfd890e5725f4f085386812eeb65c53197 /sonar-plugin-api-impl/src/test | |
parent | cdeca9bf6ccd0cb1a3b2d397efa8ace1ef4789c2 (diff) | |
download | sonarqube-9097b10693f9c4fe2c7bde4bccdbca151ebfa452.tar.gz sonarqube-9097b10693f9c4fe2c7bde4bccdbca151ebfa452.zip |
SONAR-16232 Use plugin api version for SonarRuntime impl
- introduce internal SonarQubeVersion
Diffstat (limited to 'sonar-plugin-api-impl/src/test')
-rw-r--r-- | sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java index e7f1e23021d..fc340b90d87 100644 --- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java +++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/internal/MetadataLoaderTest.java @@ -33,11 +33,18 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class MetadataLoaderTest { - private System2 system = mock(System2.class); + private final System2 system = mock(System2.class); @Test - public void load_version_from_file_in_classpath() { - Version version = MetadataLoader.loadVersion(System2.INSTANCE); + public void load_api_version_from_file_in_classpath() { + Version version = MetadataLoader.loadApiVersion(System2.INSTANCE); + assertThat(version).isNotNull(); + assertThat(version.major()).isGreaterThanOrEqualTo(5); + } + + @Test + public void load_sq_version_from_file_in_classpath() { + Version version = MetadataLoader.loadSQVersion(System2.INSTANCE); assertThat(version).isNotNull(); assertThat(version.major()).isGreaterThanOrEqualTo(5); } @@ -66,9 +73,9 @@ public class MetadataLoaderTest { public void throw_ISE_if_fail_to_load_version() throws Exception { when(system.getResource(anyString())).thenReturn(new File("target/unknown").toURI().toURL()); - assertThatThrownBy(() -> MetadataLoader.loadVersion(system)) + assertThatThrownBy(() -> MetadataLoader.loadApiVersion(system)) .isInstanceOf(IllegalStateException.class) - .hasMessageContaining("Can not load /sq-version.txt from classpath"); + .hasMessageContaining("Can not load /sonar-api-version.txt from classpath"); } } |