/*
 * Copyright 2015 The Netty Project
 *
 * The Netty Project licenses this file to you under the Apache License,
 * version 2.0 (the "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at:
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */
package io.netty.util.concurrent;

import org.junit.Assert;
import org.junit.Test;

import java.util.concurrent.atomic.AtomicReference;

public class SingleThreadEventExecutorTest {

    @Test
    public void testThreadDetails() {
        final AtomicReference<Thread> threadRef = new AtomicReference<Thread>();
        SingleThreadEventExecutor executor = new SingleThreadEventExecutor(
                null, new DefaultThreadFactory("test"), false) {
            @Override
            protected void run() {
                threadRef.set(Thread.currentThread());
                while (!confirmShutdown()) {
                    Runnable task = takeTask();
                    if (task != null) {
                        task.run();
                    }
                }
            }
        };
        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();
    }
}

@@ -851,14 +851,17 @@
 read
-Detail
+Propertie
 s() 
@@ -1506,82 +1506,8 @@
 s();
-%0A        Assert.assertSame(threadProperties, executor.threadProperties());
 %0A%0A  
@@ -1769,82 +1769,8 @@
 ));%0A
-        Assert.assertEquals(thread.getState(), threadProperties.state());%0A
     
@@ -1836,24 +1836,24 @@
 isAlive());%0A
+
         Asse
@@ -1921,95 +1921,8 @@
 ));%0A
-        Assert.assertEquals(thread.isInterrupted(), threadProperties.isInterrupted());%0A
     

Fix flacky test introduced by previous commit.