From 68bf49f639ff34f4be4dcb2399d86f37366caa31 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 25 Apr 2021 23:35:30 +0200 Subject: [PATCH] Add emptyTest --- .../java/app/model/languages/EmptyTest.java | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 src/test/java/app/model/languages/EmptyTest.java diff --git a/src/test/java/app/model/languages/EmptyTest.java b/src/test/java/app/model/languages/EmptyTest.java new file mode 100644 index 0000000..bb4e8e0 --- /dev/null +++ b/src/test/java/app/model/languages/EmptyTest.java @@ -0,0 +1,77 @@ +package app.model.languages; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +import app.model.ProgrammingLanguage; + +public class EmptyTest { + + private ProgrammingLanguage lang = new Empty(); + + @Test + @DisplayName("Test commentLine") + public void testCommentLine() { + String line = "test"; + + assertEquals(line, lang.commentLine(line)); + } + + @Test + @DisplayName("Test unCommentLine") + public void testUnCommentLine() { + String line = "test"; + + assertEquals(line, lang.unCommentLine("test")); + } + + @Test + @DisplayName("Test combination of commentLine and unCommentLine") + public void testCommentUnCommentLine() { + String line = "test"; + String wrapped1 = lang.unCommentLine(lang.commentLine(line)); + String wrapped2 = lang.unCommentLine(lang.commentLine(wrapped1)); + + assertEquals(line, wrapped1); + assertEquals(line, wrapped2); + } + + + @Test + @DisplayName("Test commentSelection") + public void testCommentSelection() { + String selection = "This\nis a multiline\nstring"; + + assertEquals(selection, lang.commentSelection(selection)); + assertEquals(selection, lang.commentSelection(lang.commentSelection(selection))); + } + + @Test + @DisplayName("Test unCommentSelection") + public void testUnCommentSelection() { + String selection = "This\nis a multiline\nstring"; + + assertEquals(selection, lang.unCommentSelection(selection)); + assertEquals(selection, lang.unCommentSelection(lang.unCommentSelection(selection))); + } + + @Test + @DisplayName("Test isCommentedLine") + public void testIsCommentedLine() { + String line = "test"; + + assertFalse(lang.isCommentedLine(line)); + } + + @Test + @DisplayName("Test isCommentedSelection") + public void testIsCommentedSelection() { + String selection = "test"; + + assertFalse(lang.isCommentedSelection(selection)); + } + +}