KillRing { public String yankPop() { lastKill = false; if (lastYank) { prev(); return slots[head]; } return null; } KillRing(int size);  KillRing(); void resetLastYank(); void resetLastKill(); boolean lastYank(); void add(String str); void addBackwards(String str); String yank(); String yankPop();  }
@Test public void testYankPop() { KillRing killRing = new KillRing(); killRing.add("foo"); killRing.resetLastKill(); killRing.add("bar"); killRing.resetLastKill(); killRing.add("baz"); String yanked = killRing.yank(); assertNotNull(yanked); assertEquals(yanked, "baz"); yanked = killRing.yankPop(); assertNotNull(yanked); assertEquals(yanked, "bar"); yanked = killRing.yankPop(); assertNotNull(yanked); assertEquals(yanked, "foo"); yanked = killRing.yankPop(); assertNotNull(yanked); assertEquals(yanked, "baz"); }