Code example for Vector

Methods: add

0
        assertNotNull( bson.get( "date" ) );
        assertTrue( bson.get( "date" ) instanceof java.util.Date );
 
        // Check that the hooks registered 
        assertNotNull( BSON.getEncodingHooks( TestDate.class ) ); 
        Vector expect = new Vector( 1 );
        expect.add( tf );
        assertEquals( BSON.getEncodingHooks( TestDate.class ), expect );
        assertTrue( BSON.getEncodingHooks( TestDate.class ).contains( tf ) );
        BSON.removeEncodingHook( TestDate.class, tf );
        assertFalse( BSON.getEncodingHooks( TestDate.class ).contains( tf ) );
    } 
 
    @Test 
    @SuppressWarnings({"deprecation", "unchecked"}) 
    public void testCustomDecoders()  
      throws IOException{ 
        // If clearDecodingHooks isn't working this whole test will fail. 
        Transformer tf = new TestDateTransformer();
        BSON.addDecodingHook( Date.class, tf );
        BSON.clearDecodingHooks();