Skip to content

Commit

Permalink
+ тесты
Browse files Browse the repository at this point in the history
  • Loading branch information
otymko committed Jun 1, 2020
1 parent 284ed02 commit c845530
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
}

}
16 changes: 16 additions & 0 deletions src/test/resources/LSConfiguration/.bsl-language-server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"language": "ru",
"codeLens": {
"showCognitiveComplexity": false,
"showCyclomaticComplexity": false
},
"diagnostics": {
"computeTrigger": "onSave",
"skipSupport": "never"
},
"documentLink": {
"useDevSite": false
},
"traceLog": null,
"configurationRoot": "src"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"diagnosticLanguage": "ru",
"showCognitiveComplexityCodeLens": false,
"showCyclomaticComplexityCodeLens": false,
"computeDiagnosticsSkipSupport": "never",
"traceLog": null,
"configurationRoot": "src"
}

0 comments on commit c845530

Please sign in to comment.