BondsTypesFixer { public void fixBondsTypes(String widgetId, List<Property> properties) { List<T> artifactsUsingWidget = repository.findByObjectId(widgetId); FixBondsTypesVisitor fixBondsTypesVisitor = new FixBondsTypesVisitor(properties); for (T artifactUsingWidget : artifactsUsingWidget) { fixBondsTypesVisitor.visit(artifactUsingWidget); repository.save(artifactUsingWidget); } } BondsTypesFixer(Repository<T> repository); void fixBondsTypes(String widgetId, List<Property> properties);  }
@Test public void should_fix_bonds_types_in_all_pages() throws Exception { Component labelComponent = aComponent("labelComponent").withPropertyValue("text", "constant", "").build(); Page page = aPage().with(labelComponent).build(); when(pageRepository.findByObjectId("labelWidget")).thenReturn(singletonList(page)); bondsTypesFixer.fixBondsTypes("labelWidget", singletonList( aProperty().name("text").bond(INTERPOLATION).build())); assertThat(labelComponent.getPropertyValues().get("text").getType()).isEqualTo(INTERPOLATION.toJson()); verify(pageRepository).save(page); }