File tree Expand file tree Collapse file tree
dd-java-agent/agent-tooling/src
main/java/datadog/trace/agent/tooling
test/groovy/datadog/trace/agent/tooling Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,6 +84,9 @@ public static MethodDescription getMethodDefinition(
8484 return type .getDeclaredMethods ().filter (named (methodName )).getOnly ();
8585 }
8686
87+ /**
88+ * @return The current stack trace with multiple entries on new lines.
89+ */
8790 public static String getStackTraceAsString () {
8891 StackTraceElement [] stackTrace = Thread .currentThread ().getStackTrace ();
8992 StringBuilder stringBuilder = new StringBuilder ();
Original file line number Diff line number Diff line change 1+ package datadog.trace.agent.tooling
2+
3+ import spock.lang.Specification
4+
5+
6+ class UtilsTest extends Specification {
7+
8+ def " getStackTraceAsString() returns the stack trace as a single new line separated string" () {
9+ setup :
10+ def stackTrace = Utils . stackTraceAsString
11+
12+ expect :
13+ stackTrace. contains(' datadog.trace.agent.tooling.Utils' )
14+ stackTrace. contains(System . getProperty(" line.separator" ))
15+ }
16+ }
You can’t perform that action at this time.
0 commit comments