Code example for Date

0
 
public class BasicDBObjectTest extends TestCase {
 
    @Test 
    public void testGetDate() { 
        final Date date = new Date();
        BasicDBObject doc = new BasicDBObject( "foo" , date);
        assertTrue( doc.getDate( "foo" ).equals( date ) );
    } 
 
    @Test 
    public void testGetDateWithDefault() { 
        final Date date = new Date();
        BasicDBObject doc = new BasicDBObject( "foo" , date);
        assertTrue( doc.getDate( "foo", new Date() ).equals( date ) );
        assertTrue( doc.getDate( "bar", date ).equals( date ) );
    } 
 
    @Test 
    public void testGetObjectId() {