@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);
  }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    PluggableSCMMaterial that = (PluggableSCMMaterial) o;

    if (this.getFingerprint() != null
        ? !this.getFingerprint().equals(that.getFingerprint())
        : that.getFingerprint() != null) {
      return false;
    }

    return true;
  }
  @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);
  }