8 |
|
|
9 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
10 |
|
import static java.util.concurrent.TimeUnit.NANOSECONDS; |
11 |
+ |
import static java.util.concurrent.TimeUnit.SECONDS; |
12 |
|
|
13 |
|
import java.util.ArrayList; |
14 |
|
import java.util.List; |
651 |
|
*/ |
652 |
|
public void testConstructor1() { |
653 |
|
try { |
654 |
< |
new ThreadPoolExecutor(-1, 1, |
654 |
< |
LONG_DELAY_MS, MILLISECONDS, |
654 |
> |
new ThreadPoolExecutor(-1, 1, 1L, SECONDS, |
655 |
|
new ArrayBlockingQueue<Runnable>(10)); |
656 |
|
shouldThrow(); |
657 |
|
} catch (IllegalArgumentException success) {} |
662 |
|
*/ |
663 |
|
public void testConstructor2() { |
664 |
|
try { |
665 |
< |
new ThreadPoolExecutor(1, -1, |
666 |
< |
LONG_DELAY_MS, MILLISECONDS, |
665 |
> |
new ThreadPoolExecutor(1, -1, 1L, SECONDS, |
666 |
|
new ArrayBlockingQueue<Runnable>(10)); |
667 |
|
shouldThrow(); |
668 |
|
} catch (IllegalArgumentException success) {} |
673 |
|
*/ |
674 |
|
public void testConstructor3() { |
675 |
|
try { |
676 |
< |
new ThreadPoolExecutor(1, 0, |
678 |
< |
LONG_DELAY_MS, MILLISECONDS, |
676 |
> |
new ThreadPoolExecutor(1, 0, 1L, SECONDS, |
677 |
|
new ArrayBlockingQueue<Runnable>(10)); |
678 |
|
shouldThrow(); |
679 |
|
} catch (IllegalArgumentException success) {} |
684 |
|
*/ |
685 |
|
public void testConstructor4() { |
686 |
|
try { |
687 |
< |
new ThreadPoolExecutor(1, 2, |
690 |
< |
-1L, MILLISECONDS, |
687 |
> |
new ThreadPoolExecutor(1, 2, -1L, SECONDS, |
688 |
|
new ArrayBlockingQueue<Runnable>(10)); |
689 |
|
shouldThrow(); |
690 |
|
} catch (IllegalArgumentException success) {} |
695 |
|
*/ |
696 |
|
public void testConstructor5() { |
697 |
|
try { |
698 |
< |
new ThreadPoolExecutor(2, 1, |
702 |
< |
LONG_DELAY_MS, MILLISECONDS, |
698 |
> |
new ThreadPoolExecutor(2, 1, 1L, SECONDS, |
699 |
|
new ArrayBlockingQueue<Runnable>(10)); |
700 |
|
shouldThrow(); |
701 |
|
} catch (IllegalArgumentException success) {} |
706 |
|
*/ |
707 |
|
public void testConstructorNullPointerException() { |
708 |
|
try { |
709 |
< |
new ThreadPoolExecutor(1, 2, |
714 |
< |
LONG_DELAY_MS, MILLISECONDS, |
709 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
710 |
|
(BlockingQueue) null); |
711 |
|
shouldThrow(); |
712 |
|
} catch (NullPointerException success) {} |
717 |
|
*/ |
718 |
|
public void testConstructor6() { |
719 |
|
try { |
720 |
< |
new ThreadPoolExecutor(-1, 1, |
726 |
< |
LONG_DELAY_MS, MILLISECONDS, |
720 |
> |
new ThreadPoolExecutor(-1, 1, 1L, SECONDS, |
721 |
|
new ArrayBlockingQueue<Runnable>(10), |
722 |
|
new SimpleThreadFactory()); |
723 |
|
shouldThrow(); |
729 |
|
*/ |
730 |
|
public void testConstructor7() { |
731 |
|
try { |
732 |
< |
new ThreadPoolExecutor(1, -1, |
739 |
< |
LONG_DELAY_MS, MILLISECONDS, |
732 |
> |
new ThreadPoolExecutor(1, -1, 1L, SECONDS, |
733 |
|
new ArrayBlockingQueue<Runnable>(10), |
734 |
|
new SimpleThreadFactory()); |
735 |
|
shouldThrow(); |
741 |
|
*/ |
742 |
|
public void testConstructor8() { |
743 |
|
try { |
744 |
< |
new ThreadPoolExecutor(1, 0, |
752 |
< |
LONG_DELAY_MS, MILLISECONDS, |
744 |
> |
new ThreadPoolExecutor(1, 0, 1L, SECONDS, |
745 |
|
new ArrayBlockingQueue<Runnable>(10), |
746 |
|
new SimpleThreadFactory()); |
747 |
|
shouldThrow(); |
753 |
|
*/ |
754 |
|
public void testConstructor9() { |
755 |
|
try { |
756 |
< |
new ThreadPoolExecutor(1, 2, |
765 |
< |
-1L, MILLISECONDS, |
756 |
> |
new ThreadPoolExecutor(1, 2, -1L, SECONDS, |
757 |
|
new ArrayBlockingQueue<Runnable>(10), |
758 |
|
new SimpleThreadFactory()); |
759 |
|
shouldThrow(); |
765 |
|
*/ |
766 |
|
public void testConstructor10() { |
767 |
|
try { |
768 |
< |
new ThreadPoolExecutor(2, 1, |
778 |
< |
LONG_DELAY_MS, MILLISECONDS, |
768 |
> |
new ThreadPoolExecutor(2, 1, 1L, SECONDS, |
769 |
|
new ArrayBlockingQueue<Runnable>(10), |
770 |
|
new SimpleThreadFactory()); |
771 |
|
shouldThrow(); |
777 |
|
*/ |
778 |
|
public void testConstructorNullPointerException2() { |
779 |
|
try { |
780 |
< |
new ThreadPoolExecutor(1, 2, |
791 |
< |
LONG_DELAY_MS, MILLISECONDS, |
780 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
781 |
|
(BlockingQueue) null, |
782 |
|
new SimpleThreadFactory()); |
783 |
|
shouldThrow(); |
789 |
|
*/ |
790 |
|
public void testConstructorNullPointerException3() { |
791 |
|
try { |
792 |
< |
new ThreadPoolExecutor(1, 2, |
804 |
< |
LONG_DELAY_MS, MILLISECONDS, |
792 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
793 |
|
new ArrayBlockingQueue<Runnable>(10), |
794 |
|
(ThreadFactory) null); |
795 |
|
shouldThrow(); |
801 |
|
*/ |
802 |
|
public void testConstructor11() { |
803 |
|
try { |
804 |
< |
new ThreadPoolExecutor(-1, 1, |
817 |
< |
LONG_DELAY_MS, MILLISECONDS, |
804 |
> |
new ThreadPoolExecutor(-1, 1, 1L, SECONDS, |
805 |
|
new ArrayBlockingQueue<Runnable>(10), |
806 |
|
new NoOpREHandler()); |
807 |
|
shouldThrow(); |
813 |
|
*/ |
814 |
|
public void testConstructor12() { |
815 |
|
try { |
816 |
< |
new ThreadPoolExecutor(1, -1, |
830 |
< |
LONG_DELAY_MS, MILLISECONDS, |
816 |
> |
new ThreadPoolExecutor(1, -1, 1L, SECONDS, |
817 |
|
new ArrayBlockingQueue<Runnable>(10), |
818 |
|
new NoOpREHandler()); |
819 |
|
shouldThrow(); |
825 |
|
*/ |
826 |
|
public void testConstructor13() { |
827 |
|
try { |
828 |
< |
new ThreadPoolExecutor(1, 0, |
843 |
< |
LONG_DELAY_MS, MILLISECONDS, |
828 |
> |
new ThreadPoolExecutor(1, 0, 1L, SECONDS, |
829 |
|
new ArrayBlockingQueue<Runnable>(10), |
830 |
|
new NoOpREHandler()); |
831 |
|
shouldThrow(); |
837 |
|
*/ |
838 |
|
public void testConstructor14() { |
839 |
|
try { |
840 |
< |
new ThreadPoolExecutor(1, 2, |
856 |
< |
-1L, MILLISECONDS, |
840 |
> |
new ThreadPoolExecutor(1, 2, -1L, SECONDS, |
841 |
|
new ArrayBlockingQueue<Runnable>(10), |
842 |
|
new NoOpREHandler()); |
843 |
|
shouldThrow(); |
849 |
|
*/ |
850 |
|
public void testConstructor15() { |
851 |
|
try { |
852 |
< |
new ThreadPoolExecutor(2, 1, |
869 |
< |
LONG_DELAY_MS, MILLISECONDS, |
852 |
> |
new ThreadPoolExecutor(2, 1, 1L, SECONDS, |
853 |
|
new ArrayBlockingQueue<Runnable>(10), |
854 |
|
new NoOpREHandler()); |
855 |
|
shouldThrow(); |
861 |
|
*/ |
862 |
|
public void testConstructorNullPointerException4() { |
863 |
|
try { |
864 |
< |
new ThreadPoolExecutor(1, 2, |
882 |
< |
LONG_DELAY_MS, MILLISECONDS, |
864 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
865 |
|
(BlockingQueue) null, |
866 |
|
new NoOpREHandler()); |
867 |
|
shouldThrow(); |
873 |
|
*/ |
874 |
|
public void testConstructorNullPointerException5() { |
875 |
|
try { |
876 |
< |
new ThreadPoolExecutor(1, 2, |
895 |
< |
LONG_DELAY_MS, MILLISECONDS, |
876 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
877 |
|
new ArrayBlockingQueue<Runnable>(10), |
878 |
|
(RejectedExecutionHandler) null); |
879 |
|
shouldThrow(); |
885 |
|
*/ |
886 |
|
public void testConstructor16() { |
887 |
|
try { |
888 |
< |
new ThreadPoolExecutor(-1, 1, |
908 |
< |
LONG_DELAY_MS, MILLISECONDS, |
888 |
> |
new ThreadPoolExecutor(-1, 1, 1L, SECONDS, |
889 |
|
new ArrayBlockingQueue<Runnable>(10), |
890 |
|
new SimpleThreadFactory(), |
891 |
|
new NoOpREHandler()); |
898 |
|
*/ |
899 |
|
public void testConstructor17() { |
900 |
|
try { |
901 |
< |
new ThreadPoolExecutor(1, -1, |
922 |
< |
LONG_DELAY_MS, MILLISECONDS, |
901 |
> |
new ThreadPoolExecutor(1, -1, 1L, SECONDS, |
902 |
|
new ArrayBlockingQueue<Runnable>(10), |
903 |
|
new SimpleThreadFactory(), |
904 |
|
new NoOpREHandler()); |
911 |
|
*/ |
912 |
|
public void testConstructor18() { |
913 |
|
try { |
914 |
< |
new ThreadPoolExecutor(1, 0, |
936 |
< |
LONG_DELAY_MS, MILLISECONDS, |
914 |
> |
new ThreadPoolExecutor(1, 0, 1L, SECONDS, |
915 |
|
new ArrayBlockingQueue<Runnable>(10), |
916 |
|
new SimpleThreadFactory(), |
917 |
|
new NoOpREHandler()); |
924 |
|
*/ |
925 |
|
public void testConstructor19() { |
926 |
|
try { |
927 |
< |
new ThreadPoolExecutor(1, 2, |
950 |
< |
-1L, MILLISECONDS, |
927 |
> |
new ThreadPoolExecutor(1, 2, -1L, SECONDS, |
928 |
|
new ArrayBlockingQueue<Runnable>(10), |
929 |
|
new SimpleThreadFactory(), |
930 |
|
new NoOpREHandler()); |
937 |
|
*/ |
938 |
|
public void testConstructor20() { |
939 |
|
try { |
940 |
< |
new ThreadPoolExecutor(2, 1, |
964 |
< |
LONG_DELAY_MS, MILLISECONDS, |
940 |
> |
new ThreadPoolExecutor(2, 1, 1L, SECONDS, |
941 |
|
new ArrayBlockingQueue<Runnable>(10), |
942 |
|
new SimpleThreadFactory(), |
943 |
|
new NoOpREHandler()); |
950 |
|
*/ |
951 |
|
public void testConstructorNullPointerException6() { |
952 |
|
try { |
953 |
< |
new ThreadPoolExecutor(1, 2, |
978 |
< |
LONG_DELAY_MS, MILLISECONDS, |
953 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
954 |
|
(BlockingQueue) null, |
955 |
|
new SimpleThreadFactory(), |
956 |
|
new NoOpREHandler()); |
963 |
|
*/ |
964 |
|
public void testConstructorNullPointerException7() { |
965 |
|
try { |
966 |
< |
new ThreadPoolExecutor(1, 2, |
992 |
< |
LONG_DELAY_MS, MILLISECONDS, |
966 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
967 |
|
new ArrayBlockingQueue<Runnable>(10), |
968 |
|
new SimpleThreadFactory(), |
969 |
|
(RejectedExecutionHandler) null); |
976 |
|
*/ |
977 |
|
public void testConstructorNullPointerException8() { |
978 |
|
try { |
979 |
< |
new ThreadPoolExecutor(1, 2, |
1006 |
< |
LONG_DELAY_MS, MILLISECONDS, |
979 |
> |
new ThreadPoolExecutor(1, 2, 1L, SECONDS, |
980 |
|
new ArrayBlockingQueue<Runnable>(10), |
981 |
|
(ThreadFactory) null, |
982 |
|
new NoOpREHandler()); |