Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan committed Aug 25, 2023
1 parent 224df67 commit c7ab603
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/java/org/fusesource/jansi/AnsiRendererTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import static org.fusesource.jansi.AnsiRenderer.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
Expand All @@ -32,7 +33,6 @@
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
*/
public class AnsiRendererTest {

@BeforeAll
static void setUp() {
Ansi.setEnabled(true);
Expand Down Expand Up @@ -95,7 +95,6 @@ public void testRender5() {
assertEquals(ansi().a(INTENSITY_BOLD).a("Hello").reset().toString(), str);
}


@Test
public void testRenderNothing() {
assertEquals("foo", render("foo"));
Expand All @@ -107,9 +106,14 @@ public void testRenderInvalidMissingEnd() {
assertEquals("@|bold foo", str);
}

@Test
public void testRenderInvalidEndBeforeStart() {
assertThrows(IllegalArgumentException.class, () -> render("@|@"));
}

@Test
public void testRenderInvalidMissingText() {
String str = render("@|bold|@");
assertEquals("@|bold|@", str);
}
}
}

0 comments on commit c7ab603

Please sign in to comment.