From 9139a99023a0e125e461ee3168105a492ac3204e Mon Sep 17 00:00:00 2001 From: kennguyengk Date: Mon, 22 Aug 2022 07:40:42 -0400 Subject: [PATCH] add junit test --- src/tests/UnitTesting.java | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/tests/UnitTesting.java diff --git a/src/tests/UnitTesting.java b/src/tests/UnitTesting.java new file mode 100644 index 00000000..2dc185e3 --- /dev/null +++ b/src/tests/UnitTesting.java @@ -0,0 +1,43 @@ +package tests; +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +public class MyClass { + + + @Test + public void test_01() { + + //assertThrows() + assertThrows(IllegalArgumentException.class,() ->{ + CompressString.compress(""); + + }); + } + @Test + public void test_02() { + + assertEquals("a2b",CompressString.compress("aab")); + + } + @Test + public void test_03() { + + assertEquals("ab",CompressString.compress("ab")); + + } + @Test + public void test_04() { + + assertEquals("abc",CompressString.compress("abc")); + + } + @Test + public void test_05() { + + assertEquals("abc2",CompressString.compress("abcc")); + + } + +} \ No newline at end of file