### Question:
JDBCInputFormat extends GenericInputFormat implements NonParallelInput { public JDBCInputFormat() {} JDBCInputFormat();  JDBCInputFormat(String driverName, String dbURL, String username, String password, String query);  JDBCInputFormat(String driverName, String dbURL, String query);  JDBCInputFormat(Configuration parameters, String query); @Override void configure(Configuration parameters); @Override boolean reachedEnd(); @Override Record nextRecord(Record record); final String DRIVER_KEY; final String USERNAME_KEY; final String PASSWORD_KEY; final String URL_KEY; final String QUERY_KEY; }### Answer:
@Test public void testJDBCInputFormat() throws IOException { jdbcInputFormat = new JDBCInputFormat("org.apache.derby.jdbc.EmbeddedDriver", "jdbc:derby:memory:ebookshop", "select * from books"); jdbcInputFormat.configure(null); Record record = new Record(); int recordCount = 0; while (!jdbcInputFormat.reachedEnd()) { jdbcInputFormat.nextRecord(record); Assert.assertEquals(5, record.getNumFields()); Assert.assertEquals("Field 0 should be int", IntValue.class, record.getField(0, IntValue.class).getClass()); Assert.assertEquals("Field 1 should be String", StringValue.class, record.getField(1, StringValue.class).getClass()); Assert.assertEquals("Field 2 should be String", StringValue.class, record.getField(2, StringValue.class).getClass()); Assert.assertEquals("Field 3 should be float", DoubleValue.class, record.getField(3, DoubleValue.class).getClass()); Assert.assertEquals("Field 4 should be int", IntValue.class, record.getField(4, IntValue.class).getClass()); int[] pos = {0, 1, 2, 3, 4}; Value[] values = {new IntValue(), new StringValue(), new StringValue(), new DoubleValue(), new IntValue()}; Assert.assertTrue(record.equalsFields(pos, dbData[recordCount], values)); recordCount++; } Assert.assertEquals(5, recordCount); cleanUpDerbyDatabases(); }