Skip to content
Snippets Groups Projects
Commit f2a86edc authored by Christopher Bohn's avatar Christopher Bohn :thinking:
Browse files

added test helper method, added testPushThreeElements

parent 16613ddb
Branches
No related tags found
No related merge requests found
...@@ -17,6 +17,12 @@ public class MyStackTest { ...@@ -17,6 +17,12 @@ public class MyStackTest {
public void tearDown() { public void tearDown() {
} }
private void pushDummies(int numberOfDummies) {
for (int i=0; i<numberOfDummies; i++) {
stack.push(new Object());
}
}
@Test @Test
public void testEmptyStack() { public void testEmptyStack() {
assertEquals(0, stack.size()); assertEquals(0, stack.size());
...@@ -24,7 +30,13 @@ public class MyStackTest { ...@@ -24,7 +30,13 @@ public class MyStackTest {
@Test @Test
public void testPushOneElement() { public void testPushOneElement() {
stack.push(new Object()); pushDummies(1);
assertEquals(1, stack.size()); assertEquals(1, stack.size());
} }
@Test
public void testPushThreeElements() {
pushDummies(3);
assertEquals(3, stack.size());
}
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment