@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()); }
@Test public void shouldReturnNullOnEmptyPeak() throws Exception { Stack stack = new Stack(); String peek = stack.peek(); assertThat(peek, is(nullValue())); }