Skip to content

Commit

Permalink
[alerter] add AlerterWorkerPoolTest (#443) (#565)
Browse files Browse the repository at this point in the history
  • Loading branch information
898349230 authored Jan 12, 2023
1 parent 7a654df commit 5d3eb0c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions alerter/src/test/java/com/usthe/alert/AlerterWorkerPoolTest.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
package com.usthe.alert;

import com.usthe.alert.controller.AlertDefineController;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

/**
* Test case for {@link AlerterWorkerPool}
*/
class AlerterWorkerPoolTest {

private AlerterWorkerPool pool ;

@BeforeEach
void setUp() {
pool = new AlerterWorkerPool();
}

@Test
void executeJob() {
for (int i = 1; i <= 10; i++) {
int c = i;
pool.executeJob(() -> {
System.out.println("currentTIme ==> " + System.currentTimeMillis() + " threadName " + " ==> " + Thread.currentThread() + " current = " + c);
});
}
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("currentTIme ==> " + System.currentTimeMillis() + " threadName " + " ==> " + Thread.currentThread() + " done... ");
}
}

0 comments on commit 5d3eb0c

Please sign in to comment.