@Test public void testPush() { // Stack stack = new Stack(5); Integer i = 0; stack.push(i); assertFalse("Stack size = 1", stack.isEmpty()); Stack<Double> stackDouble = new Stack<Double>(); Double f = 0.1; stackDouble.push(f); assertFalse("Stack size = 1", stackDouble.isEmpty()); }
@Test public void testEmpty() { Stack<String> testStack = new Stack<String>(); assertTrue(testStack.isEmpty()); String test = "Test"; testStack.push(test); assertFalse(testStack.isEmpty()); testStack.pop(); assertTrue(testStack.isEmpty()); }
@Test public void testPushPop() { // Stack stack = new Stack(5); stack.push(0); stack.pop(); assertTrue("Stack is empty", stack.isEmpty()); }
@Test public void PushNull() { // Stack stack = new Stack(2); Integer i = null; stack.push(i); assertFalse("Stack size = 1", stack.isEmpty()); }
/** Test of isEmpty method, of class Stack. Stack is empty. */ @Test public void testIsEmpty() { System.out.println("isEmpty"); Stack instance = new Stack(1); boolean expResult = true; boolean result = instance.isEmpty(); assertEquals(expResult, result); }
@Test public void testBasicFeatures() { Stack stack = new Stack(); assertTrue(stack.isEmpty()); stack.push("first"); assertFalse(stack.isEmpty()); String peek = stack.peek(); assertThat(peek, is("first")); assertFalse(stack.isEmpty()); String pop = stack.pop(); assertThat(pop, is("first")); assertTrue(stack.isEmpty()); }
@SuppressWarnings("unused") @Test public void testTopWithIsEmpty() { // Stack stack = new Stack(2); stack.push(0); int top = stack.top(); assertFalse("Stack size = 1", stack.isEmpty()); }
@Test public void testIsEmpty() { // Stack stack = new Stack(5); boolean empty = stack.isEmpty(); assertTrue("Stack is empty", empty); }