### Question:
StackTrace extends ModelObject { @Override public void toString(PrintStream stream, Mode mode) { for (StackTraceElement e: elements) { stream.println(); stream.append("\tat ").append(e.toString()); } stream.println(); } StackTrace(@Nonnull StackTraceElement... elements);  StackTrace(@Nonnull List<StackTraceElement> elements); static StackTraceElement element(String declaringClass, String methodName, String fileName, int lineNumber); static StackTraceElement element(String declaringClass, String methodName, String fileName); static StackTraceElement element(String declaringClass, String methodName); static StackTraceElement nativeElement(String declaringClass, String methodName); static StackTraceElement nativeElement(String declaringClass, String methodName, String fileName); int size(); @CheckForNull StackTraceElement getElement(@Nonnegative int depth); @CheckForNull StackTraceElement getHead(); @CheckForNull StackTraceElement head(); @Nonnull List<StackTraceElement> getElements(); @Override void toString(PrintStream stream, Mode mode); @Override int hashCode(); @Override boolean equals(Object rhs);  }### Answer:
@Test public void testToString() { StackTrace st = new StackTrace( StackTrace.element("Yyy", "xxx", "Yyy.java", 42), StackTrace.element("Yyy", "xxx", "Yyy.java") ); assertThat(st.toString(), equalTo(String.format("%n\tat Yyy.xxx(Yyy.java:42)%n\tat Yyy.xxx(Yyy.java)%n"))); }