### Question:
StringUtil { public static String getStackTrace( Throwable throwable ) { if (throwable == null) return null; final ByteArrayOutputStream bas = new ByteArrayOutputStream(); final PrintWriter pw = new PrintWriter(bas); throwable.printStackTrace(pw); pw.close(); return bas.toString(); } private  StringUtil(); static String combineLines( String[] lines ); static String combineLines( String[] lines,
                                       char separator ); static List<String> splitLines( final String content ); static String createString( String pattern,
                                       Object... parameters ); static String createString( final char charToRepeat,
                                       int numberOfRepeats ); static String setLength( String original,
                                    int length,
                                    char padChar ); static String justifyRight( String str,
                                       final int width,
                                       char padWithChar ); static String justifyLeft( String str,
                                      final int width,
                                      char padWithChar ); static String justifyCenter( String str,
                                        final int width,
                                        char padWithChar ); static String truncate( Object obj,
                                   int maxLength ); static String truncate( Object obj,
                                   int maxLength,
                                   String suffix ); static String read( Reader reader ); static String read( InputStream stream ); static void write( String content,
                              OutputStream stream ); static void write( String content,
                              Writer writer ); static String getStackTrace( Throwable throwable ); static String normalize( String text ); static String getHexString( byte[] bytes ); static byte[] fromHexString( String hexadecimal ); static final String[] EMPTY_STRING_ARRAY; }### Answer:
@Test public void getStackTraceShouldReturnStackTrace() { String msg = "This is the message for a test exception"; Throwable t = new IllegalArgumentException(msg); String trace = StringUtil.getStackTrace(t); assertThat(trace, containsString(msg)); assertThat(trace, containsString(this.getClass().getName())); }