From c8455302d51771cd85e790e67763ba1702dacb7b Mon Sep 17 00:00:00 2001 From: Tymko Oleg Date: Mon, 1 Jun 2020 23:22:05 +0700 Subject: [PATCH] =?UTF-8?q?+=20=D1=82=D0=B5=D1=81=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../phoenixbsl/lsp/BSLConfigurationTest.java | 44 +++++++++++++++++++ .../LSConfiguration/.bsl-language-server.json | 16 +++++++ .../old.bsl-language-server.json | 8 ++++ 3 files changed, 68 insertions(+) create mode 100644 src/test/java/org/github/otymko/phoenixbsl/lsp/BSLConfigurationTest.java create mode 100644 src/test/resources/LSConfiguration/.bsl-language-server.json create mode 100644 src/test/resources/LSConfiguration/old.bsl-language-server.json diff --git a/src/test/java/org/github/otymko/phoenixbsl/lsp/BSLConfigurationTest.java b/src/test/java/org/github/otymko/phoenixbsl/lsp/BSLConfigurationTest.java new file mode 100644 index 0000000..ef4ce42 --- /dev/null +++ b/src/test/java/org/github/otymko/phoenixbsl/lsp/BSLConfigurationTest.java @@ -0,0 +1,44 @@ +package org.github.otymko.phoenixbsl.lsp; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; + +import static org.assertj.core.api.Assertions.assertThat; + +public class BSLConfigurationTest { + + @Test + public void test_OldConfiguration() { + + Path path = Path.of("src/test/resources/LSConfiguration/old.bsl-language-server.json"); + var configuration = getConfigurationFromFile(path.toFile()); + assertThat(configuration).isNotNull(); + + } + + @Test + public void test_Configuration() { + + Path path = Path.of("src/test/resources/LSConfiguration/.bsl-language-server.json"); + var configuration = getConfigurationFromFile(path.toFile()); + assertThat(configuration).isNotNull(); + assertThat(configuration.getLanguage()).isNotNull(); + + } + + private BSLConfiguration getConfigurationFromFile(File file) { + BSLConfiguration configuration = null; + ObjectMapper mapper = new ObjectMapper(); + try { + configuration = mapper.readValue(file, BSLConfiguration.class); + } catch (IOException e) { + e.printStackTrace(); + } + return configuration; + } + +} diff --git a/src/test/resources/LSConfiguration/.bsl-language-server.json b/src/test/resources/LSConfiguration/.bsl-language-server.json new file mode 100644 index 0000000..293aa51 --- /dev/null +++ b/src/test/resources/LSConfiguration/.bsl-language-server.json @@ -0,0 +1,16 @@ +{ + "language": "ru", + "codeLens": { + "showCognitiveComplexity": false, + "showCyclomaticComplexity": false + }, + "diagnostics": { + "computeTrigger": "onSave", + "skipSupport": "never" + }, + "documentLink": { + "useDevSite": false + }, + "traceLog": null, + "configurationRoot": "src" +} \ No newline at end of file diff --git a/src/test/resources/LSConfiguration/old.bsl-language-server.json b/src/test/resources/LSConfiguration/old.bsl-language-server.json new file mode 100644 index 0000000..147e168 --- /dev/null +++ b/src/test/resources/LSConfiguration/old.bsl-language-server.json @@ -0,0 +1,8 @@ +{ + "diagnosticLanguage": "ru", + "showCognitiveComplexityCodeLens": false, + "showCyclomaticComplexityCodeLens": false, + "computeDiagnosticsSkipSupport": "never", + "traceLog": null, + "configurationRoot": "src" +} \ No newline at end of file