View Javadoc
1   /**
2    * 
3    */
4   package org.melati.util.test;
5   
6   import org.apache.commons.codec.binary.Base64;
7   import org.melati.util.MD5Util;
8   
9   import junit.framework.TestCase;
10  
11  /**
12   * @author timp
13   * @since 31 Jan 2008
14   *
15   */
16  public class MD5UtilTest extends TestCase {
17  
18    /**
19     * @param name
20     */
21    public MD5UtilTest(String name) {
22      super(name);
23    }
24  
25    /** 
26     * {@inheritDoc}
27     * @see junit.framework.TestCase#setUp()
28     */
29    protected void setUp() throws Exception {
30      super.setUp();
31    }
32  
33    /** 
34     * {@inheritDoc}
35     * @see junit.framework.TestCase#tearDown()
36     */
37    protected void tearDown() throws Exception {
38      super.tearDown();
39    }
40  
41    /**
42     * Test method for {@link org.melati.util.MD5Util#encode(java.lang.String)}.
43     */
44    public void testEncode() throws Exception {
45      String in = "FIXME";
46      assertEquals("Vu+/vWlc77+9cEQI77+9MduH77+9bu+/ve+/vQ==",
47          new String(Base64.encodeBase64(MD5Util.encode(in).getBytes("UTF-8"))));
48    }
49  
50  }