@@ -157,6 +157,7 @@ void testErrorSerialization() {
157157 ErrorCapture error = new ErrorCapture (tracer ).asChildOf (transaction ).withTimestamp (5000 );
158158 error .setTransactionSampled (true );
159159 error .setTransactionType ("test-type" );
160+ error .setTransactionName (new StringBuilder ("Test Transaction" ));
160161 error .setException (new Exception ("test" ));
161162 error .getContext ().addLabel ("foo" , "bar" );
162163
@@ -176,8 +177,10 @@ void testErrorSerialization() {
176177 JsonNode stacktrace = exception .get ("stacktrace" );
177178 assertThat (stacktrace ).hasSize (15 );
178179
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" );
181184 }
182185
183186 @ Test
@@ -212,6 +215,11 @@ void testErrorSerializationWithEmptyTraceId() {
212215 assertThat (errorTree .get ("trace_id" )).isNull ();
213216 assertThat (errorTree .get ("parent_id" )).isNull ();
214217 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 ();
215223 }
216224
217225 @ Test
0 commit comments