ServiceTrait extends AbstractTrait implements ToSmithyBuilder<ServiceTrait> { public String getCloudTrailEventSource() { return cloudTrailEventSource; } private  ServiceTrait(Builder builder); static Builder builder(); String getArnNamespace(); String getCloudFormationName(); String getSdkId(); String getCloudTrailEventSource(); @Deprecated Optional<String> getAbbreviation(); @Override Builder toBuilder(); static final ShapeId ID; }
@Test public void loadsEventSource() { Node node = Node.parse("{\"sdkId\": \"Foo\", \"cloudTrailEventSource\": \"foo.amazonaws.com\"}"); TraitFactory provider = TraitFactory.createServiceFactory(); Optional<Trait> trait = provider.createTrait(ServiceTrait.ID, ShapeId.from("ns.foo#foo"), node); assertTrue(trait.isPresent()); assertThat(trait.get(), instanceOf(ServiceTrait.class)); ServiceTrait serviceTrait = (ServiceTrait) trait.get(); assertThat(serviceTrait.getCloudTrailEventSource(), equalTo("foo.amazonaws.com")); }