1 61 62 package org.apache.commons.dbutils.handlers; 63 64 import java.sql.SQLException ; 65 66 import org.apache.commons.dbutils.BaseTestCase; 67 import org.apache.commons.dbutils.ResultSetHandler; 68 import org.apache.commons.dbutils.TestBean; 69 70 75 public class BeanHandlerTest extends BaseTestCase { 76 77 80 public BeanHandlerTest(String name) { 81 super(name); 82 } 83 84 public void testHandle() throws SQLException { 85 ResultSetHandler h = new BeanHandler(TestBean.class); 86 TestBean results = (TestBean) h.handle(this.rs); 87 88 assertNotNull(results); 89 assertEquals("1", results.getOne()); 90 assertEquals("2", results.getTwo()); 91 assertEquals("3", results.getThree()); 92 assertEquals("not set", results.getDoNotSet()); 93 } 94 95 public void testEmptyResultSetHandle() throws SQLException { 96 ResultSetHandler h = new BeanHandler(TestBean.class); 97 TestBean results = (TestBean) h.handle(this.emptyResultSet); 98 99 assertNull(results); 100 } 101 102 } 103 | Popular Tags |