### Question:
FireflyExtension { public boolean isHmcResetRequired() { try { FireflyExtensionModel fireflyExtensionModel = fireflyExtensionRepository.findByName(name); return !containsHmcDefinitionHash(getHmcDefinitionHash(), relaxedMode ? fireflyExtensionModel.getStates() : asList(getLastState(fireflyExtensionModel))); } catch (FireflyExtensionRepository.FireflyExtensionNotFoundException e) { return true; } } FireflyExtension(String name, File rootPath, FireflyExtensionRepository fireflyExtensionRepository, MigrationRepository migrationRepository, boolean relaxedMode); boolean isUpdateRequired(); boolean isHmcResetRequired(); void onHmcReset(PK migration); void onUpdate(PK migration); @Override String toString();  }### Answer:
@Test public void shouldRequireHmcResetIfDefinitionHashIsChanged() throws Exception { FireflyExtensionModel fireflyExtensionModel = mockExtension(mockState(null, "SOME_VALUE")); given(fireflyExtensionRepository.findByName(EXTENSION_WITH_ITEMS_XML)).willReturn(fireflyExtensionModel); boolean hmcResetRequired = fireflyExtension.isHmcResetRequired(); assertTrue(hmcResetRequired); }
@Test public void shouldNotRequireHmcResetIfDefinitionHashHasNotChanged() throws Exception { FireflyExtensionModel fireflyExtensionModel = mockExtension(mockState(null, generateMD5(HMC_XML_CONTENT))); given(fireflyExtensionRepository.findByName(EXTENSION_WITH_ITEMS_XML)).willReturn(fireflyExtensionModel); boolean hmcResetRequired = fireflyExtension.isHmcResetRequired(); assertFalse(hmcResetRequired); }
@Test public void shouldNotRequireHmcResetIfDefinitionHashIsInHistory() throws Exception { fireflyExtension = createExtension(EXTENSION_WITH_ITEMS_XML, true); FireflyExtensionModel fireflyExtensionModel = mockExtension(mockState(null, generateMD5(HMC_XML_CONTENT)), mockState(null, "SOME_VALUE")); given(fireflyExtensionRepository.findByName(EXTENSION_WITH_ITEMS_XML)).willReturn(fireflyExtensionModel); boolean updateRequired = fireflyExtension.isHmcResetRequired(); assertFalse(updateRequired); }
@Test public void shouldRequireHmcResetForNewExtension() throws Exception { givenExtensionIsNotInRepository(EXTENSION_WITH_ITEMS_XML); boolean hmcResetRequired = fireflyExtension.isHmcResetRequired(); assertTrue(hmcResetRequired); }