Added an integration test that stores and retrieves a Java Date object.

This commit is contained in:
Ulrik Sandberg
2010-10-26 21:55:47 +00:00
parent c5f850d17f
commit 17ff5ee11f

View File

@@ -20,6 +20,7 @@ import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.fail;
import java.io.Serializable;
import java.util.Date;
import java.util.LinkedList;
import javax.naming.directory.DirContext;
@@ -43,12 +44,24 @@ public class LdapTemplateObjectBindIntegrationTest extends AbstractLdapTemplateI
private LdapTemplate tested;
@Test
public void testBindJavaObject() throws Exception {
public void testBindJavaObjectDate() throws Exception {
String dn = "cn=myRandomDate";
Date now = new Date();
tested.bind(dn, now, null);
Date result = (Date) tested.lookup(dn);
assertEquals(now, result);
tested.unbind(dn);
}
@Test
public void testBindJavaObjectInteger() throws Exception {
String dn = "cn=myRandomInt";
tested.bind(dn, new Integer(54321), null);
int i = 54321;
tested.bind(dn, new Integer(i), null);
Integer result = (Integer) tested.lookup(dn);
assertEquals(54321, result.intValue());
assertEquals(i, result.intValue());
tested.unbind(dn);
}