MapShape extends Shape implements ToSmithyBuilder<MapShape> { public static Builder builder() { return new Builder(); } private  MapShape(Builder builder); static Builder builder(); @Override Builder toBuilder(); @Override R accept(ShapeVisitor<R> cases); @Override Optional<MapShape> asMapShape(); MemberShape getValue(); MemberShape getKey(); @Override Collection<MemberShape> members(); @Override boolean equals(Object other);  }
@Test public void returnsAppropriateType() { MapShape shape = MapShape.builder() .id("ns.foo#bar") .key(MemberShape.builder().id("ns.foo#bar$key").target("ns.foo#bam").build()) .value(MemberShape.builder().id("ns.foo#bar$value").target("ns.foo#bam").build()) .build(); assertEquals(shape.getType(), ShapeType.MAP); }
@Test public void mustNotContainMembersInShapeId() { Assertions.assertThrows(SourceException.class, () -> { MapShape.builder() .id("ns.foo#bar$baz") .key(MemberShape.builder().id("ns.foo#bar$key").target("ns.foo#bam").build()) .value(MemberShape.builder().id("ns.foo#bar$value").target("ns.foo#bam").build()) .build(); }); }