586 |
|
} catch (NullPointerException success) {} |
587 |
|
} |
588 |
|
|
589 |
+ |
/** |
590 |
+ |
* callable(runnable, x).toString() contains toString of wrapped task |
591 |
+ |
*/ |
592 |
+ |
public void testCallable_withResult_toString() { |
593 |
+ |
if (testImplementationDetails) { |
594 |
+ |
Runnable r = () -> {}; |
595 |
+ |
Callable<String> c = Executors.callable(r, ""); |
596 |
+ |
assertEquals( |
597 |
+ |
identityString(c) + "[Wrapped task = " + r.toString() + "]", |
598 |
+ |
c.toString()); |
599 |
+ |
} |
600 |
+ |
} |
601 |
+ |
|
602 |
+ |
/** |
603 |
+ |
* callable(runnable).toString() contains toString of wrapped task |
604 |
+ |
*/ |
605 |
+ |
public void testCallable_toString() { |
606 |
+ |
if (testImplementationDetails) { |
607 |
+ |
Runnable r = () -> {}; |
608 |
+ |
Callable<Object> c = Executors.callable(r); |
609 |
+ |
assertEquals( |
610 |
+ |
identityString(c) + "[Wrapped task = " + r.toString() + "]", |
611 |
+ |
c.toString()); |
612 |
+ |
} |
613 |
+ |
} |
614 |
+ |
|
615 |
+ |
/** |
616 |
+ |
* privilegedCallable(callable).toString() contains toString of wrapped task |
617 |
+ |
*/ |
618 |
+ |
public void testPrivilegedCallable_toString() { |
619 |
+ |
if (testImplementationDetails) { |
620 |
+ |
Callable<String> c = () -> ""; |
621 |
+ |
Callable<String> priv = Executors.privilegedCallable(c); |
622 |
+ |
assertEquals( |
623 |
+ |
identityString(priv) + "[Wrapped task = " + c.toString() + "]", |
624 |
+ |
priv.toString()); |
625 |
+ |
} |
626 |
+ |
} |
627 |
+ |
|
628 |
+ |
/** |
629 |
+ |
* privilegedCallableUsingCurrentClassLoader(callable).toString() |
630 |
+ |
* contains toString of wrapped task |
631 |
+ |
*/ |
632 |
+ |
public void testPrivilegedCallableUsingCurrentClassLoader_toString() { |
633 |
+ |
if (testImplementationDetails) { |
634 |
+ |
Callable<String> c = () -> ""; |
635 |
+ |
Callable<String> priv = Executors.privilegedCallableUsingCurrentClassLoader(c); |
636 |
+ |
assertEquals( |
637 |
+ |
identityString(priv) + "[Wrapped task = " + c.toString() + "]", |
638 |
+ |
priv.toString()); |
639 |
+ |
} |
640 |
+ |
} |
641 |
|
} |