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:
Trustin Lee 2013-03-16 18:12:13 +09:00
parent 33c988b129
commit ecb134b0dc

View File

@ -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);