// 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;
//     }
// }


import org.junit.Test;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import static de.neuland.firefly.TestUtils.unwrapException;
import static org.junit.Assert.assertEquals;
package de.neuland.firefly.utils;





public class MD5UtilTest {
    @Test
    public void shouldGenerateForString() throws Exception {
        // when
        String hash = MD5Util.generateMD5("<items><itemtypes/></items>");
        // then
        assertEquals("5b4422df25563a6e8cd98a6a1327aaa4", hash);
    }

    @Test(expected = UnsupportedEncodingException.class)
    public void shouldHandleUnsupportedEncodingException() throws Throwable {
        try {
            // when
            MD5Util.generateMD5("someValue", "myEncoding", "MD5");
        } catch (RuntimeException e) {
            // then
// 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: testsrc/de/neuland/firefly/utils/MD5UtilTest.java
import org.junit.Test;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import static de.neuland.firefly.TestUtils.unwrapException;
import static org.junit.Assert.assertEquals;

package de.neuland.firefly.utils;





public class MD5UtilTest {
    @Test
    public void shouldGenerateForString() throws Exception {
        // when
        String hash = MD5Util.generateMD5("<items><itemtypes/></items>");
        // then
        assertEquals("5b4422df25563a6e8cd98a6a1327aaa4", hash);
    }

    @Test(expected = UnsupportedEncodingException.class)
    public void shouldHandleUnsupportedEncodingException() throws Throwable {
        try {
            // when
            MD5Util.generateMD5("someValue", "myEncoding", "MD5");
        } catch (RuntimeException e) {
            // then
            unwrapException(e);