This is part of JavaUnitTestChallengeSolved. -- DonWells ---- When I saw that the one put and ten take test had failed, I thought that this test should also have failed. I am thinking that perhaps it has to do with the threads dying after 5 inputs or outputs. So I can just go ahead and change the take threads so that they all stay alive during the whole test. public class T''''''wentyThreadsTogether extends Test { public BoundedBuffer buffer; public P''''''utThread putThreads []; public T''''''akeThread takeThreads []; public void setUp(){ buffer = new BoundedBuffer(); putThreads = new P''''''utThread [10]; takeThreads = new T''''''akeThread [10]; for (int each = 0; each < 10; each++) { putThreads[each] = new P''''''utThread(buffer); takeThreads[each] = new T''''''akeThread(buffer, 50);};} public void tearDown(){ T''''''akeThread.dumpOutput();} public void runTest (){ T''''''akeThread.resetOutput(); for (int each = 0; each < 10; each++) { takeThreads[each].start();}; for (int each = 0; each < 10; each++) { putThreads[each].start();}; waitForPutToFinish(); sleepHalfSecond(); should(T''''''akeThread.outputLength() == 50, "output was too short"); should(T''''''akeThread.doesOuputHaveTenOf("a"), "should get ten a"); should(T''''''akeThread.doesOuputHaveTenOf("b"), "should get ten b"); should(T''''''akeThread.doesOuputHaveTenOf("c"), "should get ten c"); should(T''''''akeThread.doesOuputHaveTenOf("d"), "should get ten d"); should(T''''''akeThread.doesOuputHaveTenOf("e"), "should get ten e");} public void waitForPutToFinish(){ try { for (int each = 0; each < 10; each++) { putThreads[each].join(4000);}} catch (InterruptedException exception) {};} } This test fails now. http://members.aol.com/jdwells123/twentyfails.gif Interesting thing though. Sometimes it fails in a different way. Every so often it completely deadlocks. http://members.aol.com/jdwells123/twentydeadlock.gif And every so often it will in fact pass. http://members.aol.com/jdwells123/twentypassedanyway.gif What I can do for this is ExtendTheJavaTestFrameworkForNondeterminism. ---- CategoryJava