@Test
public void removesOperationsFromResourcesWhenOperationRemoved() {

    ResourceShape container = ResourceShape.builder()
            .id(ShapeId.from("ns.foo#Container"))
            .addOperation("ns.foo#A")
            .create(ShapeId.from("ns.foo#B"))
            .addOperation("ns.foo#C")
            .build();
    OperationShape a = OperationShape.builder()
            .id("ns.foo#A")
            .addTrait(new ReadonlyTrait())
            .build();
    OperationShape b = OperationShape.builder().id("ns.foo#B").build();
    OperationShape c = OperationShape.builder().id("ns.foo#C").build();
    Model model = Model.builder().addShapes(container, a, b, c).build();
    ModelTransformer transformer = ModelTransformer.create();
    Model result = transformer.removeShapes(model, Arrays.asList(a, b));
    assertThat(result.shapes().count(), Matchers.equalTo(2L));
    assertThat(result.getShape(container.getId()), Matchers.not(Optional.empty()));
    assertThat(result.getShape(c.getId()), Matchers.not(Optional.empty()));
    assertThat(result.expectShape(container.getId()).asResourceShape().get().getOperations(),
               Matchers.contains(c.getId()));
}