@Test public void removesTraits() { ShapeId aId = ShapeId.from("ns.foo#A"); StringShape a = StringShape.builder() .id(aId) .addTrait(new SensitiveTrait()) .addTrait(DeprecatedTrait.builder().build()) .build(); ShapeId bId = ShapeId.from("ns.foo#B"); StringShape b = StringShape.builder() .id(bId) .addTrait(new SensitiveTrait()) .addTrait(DeprecatedTrait.builder().build()) .build(); Model model = Model.builder().addShapes(a, b).build(); ModelTransformer transformer = ModelTransformer.create(); Model result = transformer.filterTraits( model, (shape, trait) -> !trait.toShapeId().equals(ShapeId.from("smithy.api#sensitive"))); assertThat(result.shapes().count(), Matchers.is(2L)); assertThat(result.getShape(aId).get().getTrait(SensitiveTrait.class), Matchers.is(Optional.empty())); assertThat(result.getShape(aId).get().getTrait(DeprecatedTrait.class), Matchers.not(Optional.empty())); assertThat(result.getShape(bId).get().getTrait(SensitiveTrait.class), Matchers.is(Optional.empty())); assertThat(result.getShape(bId).get().getTrait(DeprecatedTrait.class), Matchers.not(Optional.empty())); }
FilterTraits(BiPredicate<Shape, Trait> predicate) { this.predicate = predicate; }
FilterTraits { FilterTraits(BiPredicate<Shape, Trait> predicate) { this.predicate = predicate; } }
FilterTraits { FilterTraits(BiPredicate<Shape, Trait> predicate) { this.predicate = predicate; } FilterTraits(BiPredicate<Shape, Trait> predicate); }
FilterTraits { FilterTraits(BiPredicate<Shape, Trait> predicate) { this.predicate = predicate; } FilterTraits(BiPredicate<Shape, Trait> predicate);  }
FilterTraits { FilterTraits(BiPredicate<Shape, Trait> predicate) { this.predicate = predicate; } FilterTraits(BiPredicate<Shape, Trait> predicate);   }