From 3a5324a718ddc07a1a75ef1d51bb6b3fe060b18d Mon Sep 17 00:00:00 2001 From: Ruben Date: Tue, 19 Nov 2024 16:21:42 +0100 Subject: [PATCH] feat: add Basic Test Environment --- LanguageServer/pom.xml | 6 ++++++ .../src/test/java/CodeSnippetOptionsTest.java | 15 +++++++++++++++ .../java/JavaTXLanguageDocumentServiceTest.java | 14 ++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 LanguageServer/src/test/java/CodeSnippetOptionsTest.java create mode 100644 LanguageServer/src/test/java/JavaTXLanguageDocumentServiceTest.java diff --git a/LanguageServer/pom.xml b/LanguageServer/pom.xml index 5d690e2..9137ccf 100644 --- a/LanguageServer/pom.xml +++ b/LanguageServer/pom.xml @@ -20,6 +20,12 @@ antlr4 4.11.1 + + org.junit.jupiter + junit-jupiter + 5.10.0 + test + commons-io commons-io diff --git a/LanguageServer/src/test/java/CodeSnippetOptionsTest.java b/LanguageServer/src/test/java/CodeSnippetOptionsTest.java new file mode 100644 index 0000000..b1a6911 --- /dev/null +++ b/LanguageServer/src/test/java/CodeSnippetOptionsTest.java @@ -0,0 +1,15 @@ + +import de.dhbw.helper.CodeSnippetOptions; +import de.dhbw.model.SnippetWithName; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class CodeSnippetOptionsTest { + @Test + public void testForLoop() { + CodeSnippetOptions options = new CodeSnippetOptions(); + + assertEquals(options.getForLoopSnippet().getSnippet(),"for(i = 0; i < ${1:listSize}; i++){\n\n}"); + } +} diff --git a/LanguageServer/src/test/java/JavaTXLanguageDocumentServiceTest.java b/LanguageServer/src/test/java/JavaTXLanguageDocumentServiceTest.java new file mode 100644 index 0000000..53cce51 --- /dev/null +++ b/LanguageServer/src/test/java/JavaTXLanguageDocumentServiceTest.java @@ -0,0 +1,14 @@ +import de.dhbw.JavaTXTextDocumentService; +import de.dhbw.helper.CodeSnippetOptions; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class JavaTXLanguageDocumentServiceTest { + @Test + public void testWordExtraction() { + JavaTXTextDocumentService service = new JavaTXTextDocumentService(); + + assertEquals(service.getWordOfLineAndCharacter(0,0, "test"),"test"); + } +}