Code example for PreparedStatement

Methods: execute

0
     
    public void testSave() { 
        try { 
 
            final PreparedStatement st = createNiceMock( PreparedStatement.class );
            expect( st.execute() ).andReturn( true );
            replay( st );
             
            Database db = createMock( Database.class );
            expect( db.prepare((String)anyObject()) ).andReturn( st ).anyTimes();
             
            replay( db );
             
            final Properties p = new DBProperties( db );
            p.save();
             
        } 
        catch ( SQLException e ) {
            fail( e.getMessage() );
        } 
    }