ProfileCallStack { public ProfileData pop() { if (isOverflow() && overflowIndex > 0) { overflowIndex--; return rootProfile; } final ProfileData data = peek(); if (data != null) { stack[index - 1] = null; index--; } return data; } ProfileCallStack(ProfileData rootProfile);  ProfileCallStack(ProfileData rootProfile, int maxStackSize); ProfileData getRoot(); int push(final ProfileData profileData); ProfileData pop(); boolean isEmpty();  }
@Test public void testPop() { ProfileCallStack profileCallStack = new ProfileCallStack(root); profileCallStack.push(root); ProfileMethod poppedProfile = (ProfileMethod) profileCallStack.pop(); assertThat(root, sameInstance(poppedProfile)); }