@Test public void nullPut() { System.out.println("testNullPut"); String msg = ""; try { queue.put(null); } catch (CircularQueueException e) { msg = e.getMessage(); System.out.println(msg); } assertEquals(msg, "put() null item"); }
public void put(Object item) { precondition(item != null, "put() null item"); precondition(!full(), "put() into full CircularQueue"); assert invariant(); data[in++] = item; if (in >= data.length) { in = 0; wrapped = true; } assert invariant(); }
CircularQueue { public void put(Object item) { precondition(item != null, "put() null item"); precondition(!full(), "put() into full CircularQueue"); assert invariant(); data[in++] = item; if (in >= data.length) { in = 0; wrapped = true; } assert invariant(); } }
CircularQueue { public void put(Object item) { precondition(item != null, "put() null item"); precondition(!full(), "put() into full CircularQueue"); assert invariant(); data[in++] = item; if (in >= data.length) { in = 0; wrapped = true; } assert invariant(); } CircularQueue(int size); }
CircularQueue { public void put(Object item) { precondition(item != null, "put() null item"); precondition(!full(), "put() into full CircularQueue"); assert invariant(); data[in++] = item; if (in >= data.length) { in = 0; wrapped = true; } assert invariant(); } CircularQueue(int size); boolean empty(); boolean full(); boolean isWrapped(); void put(Object item); Object get(); String dump(); }
CircularQueue { public void put(Object item) { precondition(item != null, "put() null item"); precondition(!full(), "put() into full CircularQueue"); assert invariant(); data[in++] = item; if (in >= data.length) { in = 0; wrapped = true; } assert invariant(); } CircularQueue(int size); boolean empty(); boolean full(); boolean isWrapped(); void put(Object item); Object get(); String dump();  }