@Test public void testAddFrame() { String exception = "NullPointerOfCourse"; String message = "because why not!"; CrashStackTrace st = new CrashStackTrace(exception, message); st.addFrame(new Frame("clazz", "method")); st.addFrame(new Frame("clazz2", "method2")); assertThat(st.getExceptionClass(), equalTo(exception)); assertThat(st.getErrorMessage(), equalTo(message)); assertThat(st.getCause(), nullValue()); assertThat(st.highestFrameLevel(), equalTo(2)); assertThat(st, iterableWithSize(2)); }
public void addFrame(Frame frame) throws IllegalArgumentException { checkArgument(!(highestFrameLevel() > 0) || !(getFrame(highestFrameLevel()) instanceof EllipsisFrame), "Highest frame is an ellipse, no more frames can be added to this stack trace!"); checkArgument(frame != null, "Given frame may not be null!"); frames.add(frame); }
CrashStackTrace implements Iterable<Frame> { public void addFrame(Frame frame) throws IllegalArgumentException { checkArgument(!(highestFrameLevel() > 0) || !(getFrame(highestFrameLevel()) instanceof EllipsisFrame), "Highest frame is an ellipse, no more frames can be added to this stack trace!"); checkArgument(frame != null, "Given frame may not be null!"); frames.add(frame); } }
CrashStackTrace implements Iterable<Frame> { public void addFrame(Frame frame) throws IllegalArgumentException { checkArgument(!(highestFrameLevel() > 0) || !(getFrame(highestFrameLevel()) instanceof EllipsisFrame), "Highest frame is an ellipse, no more frames can be added to this stack trace!"); checkArgument(frame != null, "Given frame may not be null!"); frames.add(frame); } CrashStackTrace();  CrashStackTrace(String exceptionClass, String errorMessage);  CrashStackTrace(String exceptionClass, String errorMessage, CrashStackTrace cause); }
CrashStackTrace implements Iterable<Frame> { public void addFrame(Frame frame) throws IllegalArgumentException { checkArgument(!(highestFrameLevel() > 0) || !(getFrame(highestFrameLevel()) instanceof EllipsisFrame), "Highest frame is an ellipse, no more frames can be added to this stack trace!"); checkArgument(frame != null, "Given frame may not be null!"); frames.add(frame); } CrashStackTrace();  CrashStackTrace(String exceptionClass, String errorMessage);  CrashStackTrace(String exceptionClass, String errorMessage, CrashStackTrace cause); String getExceptionClass(); void setExceptionClass(String exceptionClass); String getErrorMessage(); void setErrorMessage(String errorMessage); CrashStackTrace getCause(); void setCause(CrashStackTrace stackTrace); @Override Iterator<Frame> iterator(); Frame removeFrame(int level); void addFrame(Frame frame); int highestFrameLevel(); Frame getFrame(int level); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
CrashStackTrace implements Iterable<Frame> { public void addFrame(Frame frame) throws IllegalArgumentException { checkArgument(!(highestFrameLevel() > 0) || !(getFrame(highestFrameLevel()) instanceof EllipsisFrame), "Highest frame is an ellipse, no more frames can be added to this stack trace!"); checkArgument(frame != null, "Given frame may not be null!"); frames.add(frame); } CrashStackTrace();  CrashStackTrace(String exceptionClass, String errorMessage);  CrashStackTrace(String exceptionClass, String errorMessage, CrashStackTrace cause); String getExceptionClass(); void setExceptionClass(String exceptionClass); String getErrorMessage(); void setErrorMessage(String errorMessage); CrashStackTrace getCause(); void setCause(CrashStackTrace stackTrace); @Override Iterator<Frame> iterator(); Frame removeFrame(int level); void addFrame(Frame frame); int highestFrameLevel(); Frame getFrame(int level); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString();  }