From 89b2aca49825b3dc868466c0b566845832cd3c25 Mon Sep 17 00:00:00 2001 From: mvilla Date: Tue, 4 Apr 2023 15:58:41 +0100 Subject: [PATCH] Add failing test --- .../model/loader/ModelAssemblerTest.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java b/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java index cc0ab3f0ae8..ea323451c5b 100644 --- a/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java +++ b/smithy-model/src/test/java/software/amazon/smithy/model/loader/ModelAssemblerTest.java @@ -391,6 +391,26 @@ public void detectsMetadataConflicts() { containsString("Metadata conflict for key `foo`")); } + @Test + public void metadataIsNotAffectedByTheSourceName() { + Model model1 = new ModelAssembler() + .addUnparsedModel("a1.smithy", "metadata items = [1]") + .addUnparsedModel("a2.smithy", "metadata items = [2]") + .addUnparsedModel("a3.smithy", "metadata items = [3]") + .assemble() + .unwrap(); + Model model2 = new ModelAssembler() + .addUnparsedModel("b1.smithy", "metadata items = [1]") + .addUnparsedModel("b2.smithy", "metadata items = [2]") + .addUnparsedModel("b3.smithy", "metadata items = [3]") + .assemble() + .unwrap(); + List metadata1 = model1.getMetadata().get("items").expectArrayNode().getElements().stream().map(s -> s.expectNumberNode().getValue()).toList(); + List metadata2 = model2.getMetadata().get("items").expectArrayNode().getElements().stream().map(s -> s.expectNumberNode().getValue()).toList(); + assertThat(metadata1, is(metadata2)); + } + + @Test public void mergesMultipleModels() { Model model = new ModelAssembler()