-
Notifications
You must be signed in to change notification settings - Fork 999
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
1 changed file
with
15 additions
and
2 deletions.
There are no files selected for viewing
17 changes: 15 additions & 2 deletions
17
alerter/src/test/java/com/usthe/alert/AlerterWorkerPoolTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... "); | ||
} | ||
} |