[#4171] Fix flacky test introduced by previous commit.
Motivation: SingleThreadEventExecutorTest was flacky. Modifications: Fixed flacky test. Result: No more test failures
This commit is contained in:
parent
52bec9726f
commit
7e5901d581
@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
public class SingleThreadEventExecutorTest {
|
||||
|
||||
@Test
|
||||
public void testThreadDetails() {
|
||||
public void testThreadProperties() {
|
||||
final AtomicReference<Thread> threadRef = new AtomicReference<Thread>();
|
||||
SingleThreadEventExecutor executor = new SingleThreadEventExecutor(
|
||||
null, Executors.newCachedThreadPool(), false) {
|
||||
@ -40,16 +40,13 @@ public class SingleThreadEventExecutorTest {
|
||||
}
|
||||
};
|
||||
ThreadProperties threadProperties = executor.threadProperties();
|
||||
Assert.assertSame(threadProperties, executor.threadProperties());
|
||||
|
||||
Thread thread = threadRef.get();
|
||||
Assert.assertEquals(thread.getId(), threadProperties.id());
|
||||
Assert.assertEquals(thread.getName(), threadProperties.name());
|
||||
Assert.assertEquals(thread.getPriority(), threadProperties.priority());
|
||||
Assert.assertEquals(thread.getState(), threadProperties.state());
|
||||
Assert.assertEquals(thread.isAlive(), threadProperties.isAlive());
|
||||
Assert.assertEquals(thread.isDaemon(), threadProperties.isDaemon());
|
||||
Assert.assertEquals(thread.isInterrupted(), threadProperties.isInterrupted());
|
||||
Assert.assertTrue(threadProperties.stackTrace().length > 0);
|
||||
executor.shutdownGracefully();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user