// Path: src/de/neuland/firefly/migration/MigrationRepository.java
// @Repository
// @Scope("prototype")
// public class MigrationRepository {
//     @Autowired private ModelService modelService;
// 
//     public FireflyMigrationModel findByPk(PK pk) {
//         return modelService.get(pk);
//     }
// 
//     public FireflyMigrationModel create() {
//         return modelService.create(FireflyMigrationModel.class);
//     }
// 
//     public void save(FireflyMigrationModel migration) {
//         modelService.save(migration);
//     }
// }
// 
// Path: testsrc/de/neuland/firefly/TestUtils.java
// public static void unwrapException(RuntimeException e) throws Throwable {
//     if (e.getCause() != null) {
//         throw e.getCause();
//     } else {
//         throw e;
//     }
// }
// 
// Path: src/de/neuland/firefly/constants/FireflyConstants.java
// public static final String NO_HMC_XML_MD5 = "NO_HMC_XML";
// 
// Path: src/de/neuland/firefly/constants/FireflyConstants.java
// public static final String NO_ITEMS_XML_MD5 = "NO_ITEMS_XML";
// 
// Path: src/de/neuland/firefly/utils/MD5Util.java
// public static String generateMD5(String baseValue) {
//     return generateMD5(baseValue, "UTF-8", "MD5");
// }


import de.hybris.platform.core.PK;
import de.neuland.firefly.migration.MigrationRepository;
import de.neuland.firefly.model.FireflyExtensionModel;
import de.neuland.firefly.model.FireflyExtensionStateModel;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.xml.sax.SAXException;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import static de.neuland.firefly.TestUtils.unwrapException;
import static de.neuland.firefly.constants.FireflyConstants.NO_HMC_XML_MD5;
import static de.neuland.firefly.constants.FireflyConstants.NO_ITEMS_XML_MD5;
import static de.neuland.firefly.utils.MD5Util.generateMD5;
import static java.util.Arrays.asList;
import static org.apache.commons.io.FileUtils.getTempDirectory;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
package de.neuland.firefly.extensionfinder;





@RunWith(MockitoJUnitRunner.class)
public class FireflyExtensionTest {
    private static final String EXTENSION_WITH_INVALID_ITEMS_XML = "invalid";
    private static final String EXTENSION_WITH_ITEMS_XML = "firefly-junit";
    private static final String EXTENSION_WITHOUT_ITEMS_XML = "none";
    private static final String ITEMS_XML_CONTENT = "<items><a>someValue</a><b/></items>";
    private static final String HMC_XML_CONTENT = "<configuration/>";
    private static final PK MIGRATION = PK.NULL_PK;
    private FireflyExtension fireflyExtension;
    @Mock private FireflyExtensionRepository fireflyExtensionRepository;
    @Mock private MigrationRepository migrationRepository;
    @Captor ArgumentCaptor<ArrayList<FireflyExtensionStateModel>> statesCaptor;

    @Before
    public void setUp() throws Exception {
        fireflyExtension = createExtension(EXTENSION_WITH_ITEMS_XML, false);
    }

    @Test
    public void shouldGetItemsDefinitionHash() throws Exception {
        // when
        String resultHash = fireflyExtension.getItemsDefinitionHash();
        // then
// Path: src/de/neuland/firefly/migration/MigrationRepository.java
// @Repository
// @Scope("prototype")
// public class MigrationRepository {
//     @Autowired private ModelService modelService;
// 
//     public FireflyMigrationModel findByPk(PK pk) {
//         return modelService.get(pk);
//     }
// 
//     public FireflyMigrationModel create() {
//         return modelService.create(FireflyMigrationModel.class);
//     }
// 
//     public void save(FireflyMigrationModel migration) {
//         modelService.save(migration);
//     }
// }
// 
// Path: testsrc/de/neuland/firefly/TestUtils.java
// public static void unwrapException(RuntimeException e) throws Throwable {
//     if (e.getCause() != null) {
//         throw e.getCause();
//     } else {
//         throw e;
//     }
// }
// 
// Path: src/de/neuland/firefly/constants/FireflyConstants.java
// public static final String NO_HMC_XML_MD5 = "NO_HMC_XML";
// 
// Path: src/de/neuland/firefly/constants/FireflyConstants.java
// public static final String NO_ITEMS_XML_MD5 = "NO_ITEMS_XML";
// 
// Path: src/de/neuland/firefly/utils/MD5Util.java
// public static String generateMD5(String baseValue) {
//     return generateMD5(baseValue, "UTF-8", "MD5");
// }


// Path: testsrc/de/neuland/firefly/extensionfinder/FireflyExtensionTest.java
import de.hybris.platform.core.PK;
import de.neuland.firefly.migration.MigrationRepository;
import de.neuland.firefly.model.FireflyExtensionModel;
import de.neuland.firefly.model.FireflyExtensionStateModel;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.xml.sax.SAXException;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import static de.neuland.firefly.TestUtils.unwrapException;
import static de.neuland.firefly.constants.FireflyConstants.NO_HMC_XML_MD5;
import static de.neuland.firefly.constants.FireflyConstants.NO_ITEMS_XML_MD5;
import static de.neuland.firefly.utils.MD5Util.generateMD5;
import static java.util.Arrays.asList;
import static org.apache.commons.io.FileUtils.getTempDirectory;
import static org.junit.Assert.*;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

package de.neuland.firefly.extensionfinder;





@RunWith(MockitoJUnitRunner.class)
public class FireflyExtensionTest {
    private static final String EXTENSION_WITH_INVALID_ITEMS_XML = "invalid";
    private static final String EXTENSION_WITH_ITEMS_XML = "firefly-junit";
    private static final String EXTENSION_WITHOUT_ITEMS_XML = "none";
    private static final String ITEMS_XML_CONTENT = "<items><a>someValue</a><b/></items>";
    private static final String HMC_XML_CONTENT = "<configuration/>";
    private static final PK MIGRATION = PK.NULL_PK;
    private FireflyExtension fireflyExtension;
    @Mock private FireflyExtensionRepository fireflyExtensionRepository;
    @Mock private MigrationRepository migrationRepository;
    @Captor ArgumentCaptor<ArrayList<FireflyExtensionStateModel>> statesCaptor;

    @Before
    public void setUp() throws Exception {
        fireflyExtension = createExtension(EXTENSION_WITH_ITEMS_XML, false);
    }

    @Test
    public void shouldGetItemsDefinitionHash() throws Exception {
        // when
        String resultHash = fireflyExtension.getItemsDefinitionHash();
        // then
        assertEquals(generateMD5(ITEMS_XML_CONTENT), resultHash);