--- jsr166/src/test/tck/ExecutorsTest.java 2017/05/29 22:44:26 1.49 +++ jsr166/src/test/tck/ExecutorsTest.java 2017/08/16 17:18:34 1.50 @@ -586,4 +586,56 @@ public class ExecutorsTest extends JSR16 } catch (NullPointerException success) {} } + /** + * callable(runnable, x).toString() contains toString of wrapped task + */ + public void testCallable_withResult_toString() { + if (testImplementationDetails) { + Runnable r = () -> {}; + Callable c = Executors.callable(r, ""); + assertEquals( + identityString(c) + "[Wrapped task = " + r.toString() + "]", + c.toString()); + } + } + + /** + * callable(runnable).toString() contains toString of wrapped task + */ + public void testCallable_toString() { + if (testImplementationDetails) { + Runnable r = () -> {}; + Callable c = Executors.callable(r); + assertEquals( + identityString(c) + "[Wrapped task = " + r.toString() + "]", + c.toString()); + } + } + + /** + * privilegedCallable(callable).toString() contains toString of wrapped task + */ + public void testPrivilegedCallable_toString() { + if (testImplementationDetails) { + Callable c = () -> ""; + Callable priv = Executors.privilegedCallable(c); + assertEquals( + identityString(priv) + "[Wrapped task = " + c.toString() + "]", + priv.toString()); + } + } + + /** + * privilegedCallableUsingCurrentClassLoader(callable).toString() + * contains toString of wrapped task + */ + public void testPrivilegedCallableUsingCurrentClassLoader_toString() { + if (testImplementationDetails) { + Callable c = () -> ""; + Callable priv = Executors.privilegedCallableUsingCurrentClassLoader(c); + assertEquals( + identityString(priv) + "[Wrapped task = " + c.toString() + "]", + priv.toString()); + } + } }