Fix sporadic failure in ThreadRenamingRunnableTest
- Make sure the ThreadNameDeterminer is reset to the default after each test to avoid the side effect between tests
This commit is contained in:
parent
33c988b129
commit
ecb134b0dc
@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.jboss.netty.util;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -26,6 +27,16 @@ import static org.junit.Assert.*;
|
||||
|
||||
public class ThreadRenamingRunnableTest {
|
||||
|
||||
@After
|
||||
public void setUp() {
|
||||
ThreadRenamingRunnable.setThreadNameDeterminer(ThreadNameDeterminer.PROPOSED);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void defaultIsProposed() {
|
||||
assertSame(ThreadNameDeterminer.PROPOSED, ThreadRenamingRunnable.getThreadNameDeterminer());
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void shouldNotAllowNullName() throws Exception {
|
||||
new ThreadRenamingRunnable(createMock(Runnable.class), null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user