Follow these steps to implement the example:
- Create a class named ProducerConsumerTest that extends the MultithreadedTestCase class:
public class ProducerConsumerTest extends MultithreadedTestCase {
- Declare a private LinkedTransferQueue attribute parameterized by the String class named queue:
private LinkedTransferQueue<String> queue;
- Implement the initialize() method. This method won't receive any parameters and will return no value. It will call the initialize() method of its parent class and then initialize the queue attribute:
@Override public void initialize() { super.initialize(); queue=new LinkedTransferQueue<String>(); System.out.printf("Test: The test has been initialized\n"); }
- Implement the thread1() ...