import java.io.UnsupportedEncodingException;

import junit.framework.TestCase;

public class Base64Test extends TestCase {

	protected void setUp() throws Exception {
		super.setUp();
	}
	
	public void test_encode() throws UnsupportedEncodingException {
		byte[] bytes = "veryveryveryveryveryveryveryveryveryveryveryveryveryverylongpassword".getBytes("iso-8859-1");
		String encodedString = Base64.encode(bytes);
		assertFalse(encodedString.endsWith("\n"));
		assertEquals("dmVyeXZlcnl2ZXJ5dmVyeXZlcnl2ZXJ5dmVyeXZlcnl2ZXJ5dmVyeXZlcnl2ZXJ5dmVyeXZlcnlsb25ncGFzc3dvcmQ=", encodedString);

		bytes = "test".getBytes("iso-8859-1");
		encodedString = Base64.encode(bytes);
		assertFalse(encodedString.endsWith("\n"));
		assertEquals("dGVzdA==", encodedString);
	}

}
