@Test public void getBoards() throws Exception{ List<Board> boards = boardDao.getBoards(); Assert.assertEquals(boards.size(), 5); for(Board board : boards){ Assert.assertNotNull(board); } }
public List<Board> getBoards(){ String sql = "select id, name, title, content, regdate, read_count " + "from board order by id desc"; try{ RowMapper<Board> rowMapper = BeanPropertyRowMapper.newInstance(Board.class); return jdbc.query(sql, rowMapper); }catch(Exception ex){ return null; } }
BoardDao { public List<Board> getBoards(){ String sql = "select id, name, title, content, regdate, read_count " + "from board order by id desc"; try{ RowMapper<Board> rowMapper = BeanPropertyRowMapper.newInstance(Board.class); return jdbc.query(sql, rowMapper); }catch(Exception ex){ return null; } } }
BoardDao { public List<Board> getBoards(){ String sql = "select id, name, title, content, regdate, read_count " + "from board order by id desc"; try{ RowMapper<Board> rowMapper = BeanPropertyRowMapper.newInstance(Board.class); return jdbc.query(sql, rowMapper); }catch(Exception ex){ return null; } } BoardDao(DataSource dataSource); }
BoardDao { public List<Board> getBoards(){ String sql = "select id, name, title, content, regdate, read_count " + "from board order by id desc"; try{ RowMapper<Board> rowMapper = BeanPropertyRowMapper.newInstance(Board.class); return jdbc.query(sql, rowMapper); }catch(Exception ex){ return null; } } BoardDao(DataSource dataSource); Long addBoard(Board board); int updateCount(Long id); int deleteBoard(Long id); int updateBoard(Board board); Board getBoard(Long id); List<Board> getBoards(); }
BoardDao { public List<Board> getBoards(){ String sql = "select id, name, title, content, regdate, read_count " + "from board order by id desc"; try{ RowMapper<Board> rowMapper = BeanPropertyRowMapper.newInstance(Board.class); return jdbc.query(sql, rowMapper); }catch(Exception ex){ return null; } } BoardDao(DataSource dataSource); Long addBoard(Board board); int updateCount(Long id); int deleteBoard(Long id); int updateBoard(Board board); Board getBoard(Long id); List<Board> getBoards();  }