diff --git a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/parse/EventStreamUnmarshallerGeneratorTest.kt b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/parse/EventStreamUnmarshallerGeneratorTest.kt index b2521012177..0b219a569d7 100644 --- a/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/parse/EventStreamUnmarshallerGeneratorTest.kt +++ b/codegen-server/src/test/kotlin/software/amazon/smithy/rust/codegen/server/smithy/protocols/parse/EventStreamUnmarshallerGeneratorTest.kt @@ -275,7 +275,9 @@ class EventStreamUnmarshallerGeneratorTest { assert!(result.is_ok(), "expected ok, got: {:?}", result); match expect_error(result.unwrap())$kindSuffix { TestStreamErrorKind::Unhandled(err) => { - assert!(format!("{}", err).contains("message: \"unmodeled error\"")); + let message = format!("{}", aws_smithy_types::error::display::DisplayErrorContext(&err)); + let expected = "message: \"unmodeled error\""; + assert!(message.contains(expected), "Expected '{message}' to contain '{expected}'"); } kind => panic!("expected generic error, but got {:?}", kind), }