@@ -157,6 +157,7 @@ void testErrorSerialization() {
157
157
ErrorCapture error = new ErrorCapture (tracer ).asChildOf (transaction ).withTimestamp (5000 );
158
158
error .setTransactionSampled (true );
159
159
error .setTransactionType ("test-type" );
160
+ error .setTransactionName (new StringBuilder ("Test Transaction" ));
160
161
error .setException (new Exception ("test" ));
161
162
error .getContext ().addLabel ("foo" , "bar" );
162
163
@@ -176,8 +177,10 @@ void testErrorSerialization() {
176
177
JsonNode stacktrace = exception .get ("stacktrace" );
177
178
assertThat (stacktrace ).hasSize (15 );
178
179
179
- assertThat (errorTree .get ("transaction" ).get ("sampled" ).booleanValue ()).isTrue ();
180
- assertThat (errorTree .get ("transaction" ).get ("type" ).textValue ()).isEqualTo ("test-type" );
180
+ JsonNode transactionTree = errorTree .get ("transaction" );
181
+ assertThat (transactionTree .get ("sampled" ).booleanValue ()).isTrue ();
182
+ assertThat (transactionTree .get ("type" ).textValue ()).isEqualTo ("test-type" );
183
+ assertThat (transactionTree .get ("name" ).asText ()).isEqualTo ("Test Transaction" );
181
184
}
182
185
183
186
@ Test
@@ -212,6 +215,11 @@ void testErrorSerializationWithEmptyTraceId() {
212
215
assertThat (errorTree .get ("trace_id" )).isNull ();
213
216
assertThat (errorTree .get ("parent_id" )).isNull ();
214
217
assertThat (errorTree .get ("transaction_id" )).isNull ();
218
+
219
+ JsonNode transactionTree = errorTree .get ("transaction" );
220
+ assertThat (transactionTree .get ("sampled" ).booleanValue ()).isFalse ();
221
+ assertThat (transactionTree .get ("type" )).isNull ();
222
+ assertThat (transactionTree .get ("name" )).isNull ();
215
223
}
216
224
217
225
@ Test
0 commit comments