dcapwell commented on code in PR #2104:
URL: https://github.com/apache/cassandra/pull/2104#discussion_r1134566386
##########
test/distributed/org/apache/cassandra/distributed/test/streaming/BoundExceptionTest.java:
##########
@@ -102,13 +93,31 @@ public void testEmptyNestedStackTrace()
{
Throwable exceptionToTest = new RuntimeException(new
IllegalArgumentException("the disk /foo/var is bad", new IOException("Bad disk
somewhere")));
exceptionToTest.setStackTrace(new StackTraceElement[0]);
- exceptionToTest.getCause().getCause().setStackTrace(new
StackTraceElement[0]);
+ exceptionToTest.getCause().setStackTrace(new StackTraceElement[0]);
+
+ StringBuilder boundedStackTrace =
StreamSession.boundStackTrace(exceptionToTest, LIMIT);
+ String expectedStackTrace = "java.lang.RuntimeException:
java.lang.IllegalArgumentException: the disk /foo/var is bad\n" +
+ "java.lang.IllegalArgumentException: the
disk /foo/var is bad\n" +
+ "java.io.IOException: Bad disk
somewhere\n" +
+
"\torg.apache.cassandra.distributed.test.streaming.BoundExceptionTest.testEmptyNestedStackTrace(BoundExceptionTest.java:94)\n"
+
+
"\tjava.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)";
+
+ assertEquals(expectedStackTrace, boundedStackTrace.toString());
+ }
+
+ @Test
+ public void testLimitLargerThanStackTrace()
+ {
+ Throwable exceptionToTest = new RuntimeException(new
IllegalArgumentException("the disk /foo/var is bad", new IOException("Bad disk
somewhere")));
+ StackTraceElement[] stackTrace = new StackTraceElement[1];
Review Comment:
nit, `Arrays.copyOf`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]