public void testBogusPostPush1() { Stack<Integer> countingStack = new BogusCountingStack<Integer>(); try { countingStack.push(1); fail(); } catch (PostconditionError expected) { assertEquals("[peek() == old (obj)]", expected.getMessages().toString()); } }
public void testBogusPostPush() { Stack<Integer> bogusPostconditionsStack = new BogusPostconditionsStack<Integer>(); try { bogusPostconditionsStack.push(1); fail(); } catch (PostconditionError expected) { assertEquals("[size() == old (size()) + 1]", expected.getMessages().toString()); } }
public void testEmptyPop() { try { stack.pop(); fail(); } catch (PreconditionError expected) { assertEquals("[size() >= 1]", expected.getMessages().toString()); } }
public void testNormal() { stack.push(1); stack.push(2); assertEquals(2, stack.size()); stack.pop(); stack.push(3); stack.pop(); stack.pop(); stack.push(4); assertEquals(1, stack.size()); }
public void testIneffectiveBogusPostPush() { Stack<Integer> lastElementStack = new BogusLastElementStack<Integer>(); lastElementStack.push(1); lastElementStack.push(2); lastElementStack.pop(); }