### Question:
DynamicViewDAO { public ViewMapVO getViewMapForView(String register, String dataType, long version) throws SQLException { String sql = "SELECT idSKRSViewMapping,tableName,createdDate FROM SKRSViewMapping WHERE register=? AND " + "datatype=? AND version=?"; ArrayListHandler handler = new ArrayListHandler(); QueryRunner qr = new QueryRunner(); Connection conn = null; try { conn = connectionProvider.get(); List<Object[]> viewMaps = qr.query(conn, sql, handler, register, dataType, version); if (viewMaps.size() < 1) { throw new DynamicViewException("View not found for " + register + "/" + dataType + "/" + version); } else if (viewMaps.size() > 1) { throw new DynamicViewException("Multiple views found for " + register + "/" + dataType + "/" + version); } Long id = (Long) viewMaps.get(0)[0]; String tableName = (String) viewMaps.get(0)[1]; Timestamp createTime = (Timestamp) viewMaps.get(0)[2]; List<ColumnMapVO> columnMaps = getColumnMapsForView(conn, id); ViewMapVO viewMap = new ViewMapVO(); viewMap.setCreatedDate(createTime); viewMap.setDatatype(dataType); viewMap.setRegister(register); viewMap.setTableName(tableName); viewMap.setVersion(version); for (ColumnMapVO columnMap : columnMaps) { viewMap.addColumn(columnMap); } return viewMap; } finally { DbUtils.close(conn); } } @Inject  DynamicViewDAO(Provider<Connection> connectionProvider); List<String> listAllViews(); ViewMapVO getViewMapForView(String register, String dataType, long version);  }### Answer:
@Test public void testGetViewMap() throws SQLException { ViewMapVO viewMapForView = dao.getViewMapForView(testRegister, testDatatype, 1); assertNotNull(viewMapForView); assertEquals(testRegister, viewMapForView.getRegister()); assertEquals(testDatatype, viewMapForView.getDatatype()); assertEquals(1, viewMapForView.getVersion()); assertEquals(testTableName, viewMapForView.getTableName()); assertNotNull(viewMapForView.getCreatedDate()); List<ColumnMapVO> columnMaps = viewMapForView.getColumnMaps(); assertEquals(1, columnMaps.size()); ColumnMapVO column1 = columnMaps.iterator().next(); assertEquals(-1, column1.getDataType()); assertEquals(1, column1.getFeedPosition()); assertEquals((Integer)100, column1.getMaxLength()); assertEquals("test_column", column1.getTableColumnName()); assertEquals("test_feed_column", column1.getFeedColumnName()); removeMapping(id); }