GitMaterialUpdater extends MaterialUpdater<GitMaterial> { @Override public boolean areMaterialsSameVersion(GitMaterial latestMaterial, GitMaterial dbMaterial) { boolean areSameVersion = false; if (dbMaterial != null) { areSameVersion = latestMaterial.getCommitId().equals(dbMaterial.getCommitId()); } return areSameVersion; } GitMaterialUpdater();  GitMaterialUpdater(IGitService gitService, IFileManagementService fileManagementService); @Override GitMaterial getLatestMaterialVersion(GitMaterial gitMaterial); @Override boolean areMaterialsSameVersion(GitMaterial latestMaterial, GitMaterial dbMaterial);  }
@Test public void areMaterialsSameVersion_matchingCommitIds_true() { GitMaterial latestMaterial = new GitMaterial(); GitMaterial dbMaterial = new GitMaterial(); latestMaterial.setCommitId("commitId"); dbMaterial.setCommitId("commitId"); boolean actualResult = this.gitMaterialUpdater.areMaterialsSameVersion(latestMaterial, dbMaterial); Assert.assertTrue(actualResult); }
@Test public void areMaterialsSameVersion_notMatchingCommitIds_false() { GitMaterial latestMaterial = new GitMaterial(); GitMaterial dbMaterial = new GitMaterial(); latestMaterial.setCommitId("commitId"); dbMaterial.setCommitId("otherCommitId"); boolean actualResult = this.gitMaterialUpdater.areMaterialsSameVersion(latestMaterial, dbMaterial); Assert.assertFalse(actualResult); }
@Test public void areMaterialsSameVersion_dbMaterialIsNull_false() { GitMaterial latestMaterial = new GitMaterial(); GitMaterial dbMaterial = null; latestMaterial.setCommitId("commitId"); boolean actualResult = this.gitMaterialUpdater.areMaterialsSameVersion(latestMaterial, dbMaterial); Assert.assertFalse(actualResult); }