### Question:
HashObject extends AbstractGeoGigOp<ObjectId> { public HashObject setObject(RevObject object) { this.object = object; return this; }  HashObject setObject(RevObject object);  }### Answer:
@Test public void testHashNullObject() throws Exception { try { hashCommand.setObject(null).call(); fail("expected IllegalStateException on null feature type"); } catch (IllegalStateException e) { assertTrue(e.getMessage().contains("Object has not been set")); } }
@Test public void testHashFeatures() throws Exception { ObjectId feature1Id = hashCommand.setObject(pointFeature1).call(); ObjectId feature2Id = hashCommand.setObject(pointFeature2).call(); ObjectId coverageFeatureId = hashCommand.setObject(coverageRevFeature).call(); ObjectId feature1DuplicateId = hashCommand.setObject(pointFeature1Duplicate).call(); assertNotNull(feature1Id); assertNotNull(feature2Id); assertNotNull(coverageFeatureId); assertNotNull(feature1DuplicateId); assertFalse(feature1Id.equals(feature2Id)); assertFalse(feature1Id.equals(coverageFeatureId)); assertFalse(feature2Id.equals(coverageFeatureId)); assertTrue(feature1Id.equals(feature1DuplicateId)); }
@Test public void testHashFeatureTypes() throws Exception { ObjectId featureType1Id = hashCommand.setObject(featureType1).call(); ObjectId featureType2Id = hashCommand.setObject(featureType2).call(); ObjectId coverageTypeId = hashCommand.setObject(coverageRevFeatureType).call(); ObjectId featureType1DuplicateId = hashCommand.setObject(featureType1Duplicate).call(); assertNotNull(featureType1Id); assertNotNull(featureType2Id); assertNotNull(coverageTypeId); assertNotNull(featureType1DuplicateId); assertFalse(featureType1Id.equals(featureType2Id)); assertFalse(featureType1Id.equals(coverageTypeId)); assertFalse(featureType2Id.equals(coverageTypeId)); assertTrue(featureType1Id.equals(featureType1DuplicateId)); }
@Test public void testHashCommits() throws Exception { ObjectId commit1Id = hashCommand.setObject(commit1).call(); ObjectId commit2Id = hashCommand.setObject(commit2).call(); ObjectId commit1DuplicateId = hashCommand.setObject(commit1Duplicate).call(); assertNotNull(commit1Id); assertNotNull(commit2Id); assertNotNull(commit1DuplicateId); assertFalse(commit1Id.equals(commit2Id)); assertTrue(commit1Id.equals(commit1DuplicateId)); }
@Test public void testHashTags() throws Exception { RevPerson tagger = new RevPersonImpl("volaya", "volaya@boundlessgeo.com", -1000, -1); RevPerson tagger2 = new RevPersonImpl("groldan", "groldan@boundlessgeo.com", 10000, 0); RevTag tag = new RevTagImpl(null, "tag1", ObjectId.forString("fake commit id"), "message", tagger); RevTag tag2 = new RevTagImpl(null, "tag2", ObjectId.forString("another fake commit id"), "another message", tagger2); ObjectId tagId = hashCommand.setObject(tag).call(); ObjectId tagId2 = hashCommand.setObject(tag2).call(); assertNotNull(tagId); assertNotNull(tagId2); assertNotSame(tagId, tagId2); }