}
private void testExpectedProperties(Runnable task, String expectedName, String expectedDescription) throws Exception {
ManagedThreadFactory threadFactory = getManagedThreadFactory();
ManagedThread thread =
(ManagedThread)threadFactory.newThread(task);
assertNull(thread.getTaskIdentityDescription());
assertNull(thread.getTaskIdentityDescription(Locale.getDefault().toString()));
assertNull(thread.getTaskIdentityName());
assertEquals(0, thread.getTaskRunTime());
assertEquals(thread.getId(), thread.getThreadID());
assertEquals(thread.getName(), thread.getThreadName());
assertFalse(thread.isTaskHung());
thread.start();
Thread.sleep(1000 * 10);
assertEquals(expectedDescription, thread.getTaskIdentityDescription());
assertEquals(expectedDescription, thread.getTaskIdentityDescription(Locale.getDefault().toString()));
assertEquals(expectedName, thread.getTaskIdentityName());
assertTrue(thread.getTaskRunTime() > 0);
assertEquals(thread.getId(), thread.getThreadID());
assertEquals(thread.getName(), thread.getThreadName());
assertFalse(thread.isTaskHung());
thread.join();
assertNull(thread.getTaskIdentityDescription());
assertNull(thread.getTaskIdentityDescription(Locale.getDefault().toString()));
assertNull(thread.getTaskIdentityName());
assertEquals(0, thread.getTaskRunTime());
assertEquals(thread.getId(), thread.getThreadID());
assertEquals(thread.getName(), thread.getThreadName());
assertFalse(thread.isTaskHung());
}