diff --git a/src/main/java/com/rampatra/misc/BotTesting.java b/src/main/java/com/rampatra/misc/BotTesting.java index 398e60b6..8de98a02 100644 --- a/src/main/java/com/rampatra/misc/BotTesting.java +++ b/src/main/java/com/rampatra/misc/BotTesting.java @@ -19,11 +19,16 @@ public class BotTesting { public static void main(String args[]) throws MalformedURLException { - final URL myURL = new URL("http://localhost:8080/ifb.html"); + + // URL use to track + String testUrl = "http://localhost:8080/ifb.html"; + final URL myURL = new URL(testUrl); ExecutorService executorService = Executors.newFixedThreadPool(20); Long start = System.currentTimeMillis(); - for (int i = 0; i <= 50; i++) { + // times to run the request + int requestTimes = 50; + for (int i = 0; i <= requestTimes; i++) { executorService.execute(new Runnable() { @Override 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