@Test
  public void shouldNotUpdateMaterialInstanceWhenConfigHas_NOT_Changed() throws Exception {
    PluggableSCMMaterial material = MaterialsMother.pluggableSCMMaterial();
    MaterialInstance materialInstance = material.createMaterialInstance();

    File file = new File("random");
    Modifications modifications = new Modifications();

    materialUpdater.insertLatestOrNewModifications(material, materialInstance, file, modifications);

    verify(materialRepository, never()).saveOrUpdate(Matchers.<MaterialInstance>any());
    verify(scmMaterialUpdater)
        .insertLatestOrNewModifications(material, materialInstance, file, modifications);
  }
  @Test
  public void shouldUpdateToNewMaterialInstanceWhenConfigHas_Changed() throws Exception {
    PluggableSCMMaterial material = MaterialsMother.pluggableSCMMaterial();
    MaterialInstance materialInstance = material.createMaterialInstance();
    materialInstance.setId(1);

    material
        .getScmConfig()
        .getConfiguration()
        .add(ConfigurationPropertyMother.create("key2", false, "value2"));
    MaterialInstance newMaterialInstance = material.createMaterialInstance();
    newMaterialInstance.setId(1);
    File file = new File("random");

    Modifications modifications = new Modifications();
    when(materialRepository.find(anyLong())).thenReturn(materialInstance);

    materialUpdater.insertLatestOrNewModifications(material, materialInstance, file, modifications);

    verify(materialRepository).saveOrUpdate(newMaterialInstance);
    verify(scmMaterialUpdater)
        .insertLatestOrNewModifications(material, materialInstance, file, modifications);
  }