|
19 | 19 | import static org.hamcrest.Matchers.equalTo;
|
20 | 20 | import static org.hamcrest.Matchers.instanceOf;
|
21 | 21 | import static org.junit.jupiter.api.Assertions.assertFalse;
|
| 22 | +import static org.junit.jupiter.api.Assertions.assertNotEquals; |
22 | 23 | import static org.junit.jupiter.api.Assertions.assertThrows;
|
23 | 24 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
24 |
| - |
25 | 25 | import java.util.Optional;
|
26 | 26 | import org.junit.jupiter.api.Test;
|
27 | 27 | import software.amazon.smithy.model.Model;
|
@@ -126,4 +126,22 @@ public void loadsFromModel() {
|
126 | 126 | assertFalse(trait.getDocId().isPresent());
|
127 | 127 | assertThat(trait.resolveDocId(service), equalTo("some-value-2018-03-17"));
|
128 | 128 | }
|
| 129 | + |
| 130 | + @Test |
| 131 | + public void equality() { |
| 132 | + Node node1 = Node.parse("{\"sdkId\": \"Foo1\", \"arnNamespace\": \"service\", \"cloudFormationName\": \"Baz\", " |
| 133 | + + "\"endpointPrefix\": \"endpoint-prefix\"}"); |
| 134 | + |
| 135 | + Node node2 = Node.parse("{\"sdkId\": \"Foo2\", \"arnNamespace\": \"service\", \"cloudFormationName\": \"Baz\", " |
| 136 | + + "\"endpointPrefix\": \"endpoint-prefix\"}"); |
| 137 | + |
| 138 | + TraitFactory provider = TraitFactory.createServiceFactory(); |
| 139 | + Optional<Trait> trait1 = provider.createTrait(ServiceTrait.ID, ShapeId.from("ns.foo#foo1"), node1); |
| 140 | + Optional<Trait> trait2 = provider.createTrait(ServiceTrait.ID, ShapeId.from("ns.foo#foo2"), node2); |
| 141 | + |
| 142 | + ServiceTrait serviceTrait1 = (ServiceTrait) trait1.get(); |
| 143 | + ServiceTrait serviceTrait2 = (ServiceTrait) trait2.get(); |
| 144 | + |
| 145 | + assertNotEquals(serviceTrait1, serviceTrait2); |
| 146 | + } |
129 | 147 | }
|
0 commit comments