Skip to content

Commit

Permalink
SimpleFuture增加异常捕获
Browse files Browse the repository at this point in the history
  • Loading branch information
leaderli committed Oct 17, 2024
1 parent afdcc83 commit 767f9ec
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
* @author leaderli
* @since 2022/8/28
Expand All @@ -18,6 +21,8 @@ class LiEventBusTest {
void getPublisher() {


ExecutorService executorService = Executors.newCachedThreadPool();
// executorService.execute();
LiEventBus eventBus = new LiEventBus();

eventBus.registerListener(new TestLiEventListener());
Expand All @@ -28,6 +33,7 @@ void getPublisher() {
eventBus.push(new TestStringLiEventObject(null));
});
eventBus.registerListener(new TestLiEventListener3());

Assertions.assertThrows(RuntimeException.class, () -> {
eventBus.push(new TestStringLiEventObject("456"));
Assertions.fail();
Expand Down Expand Up @@ -72,6 +78,12 @@ void test2() {
Assertions.assertEquals(2, listener.count);
}

@Test
void test3() {
LiEventBus liEventBus = new LiEventBus();
// liEventBus.push();

}

@Test
void unRegisterListener() {
Expand Down

0 comments on commit 767f9ec

Please sign in to comment.