### Question:
TournamentAnalyticsJdbcDao extends JdbcDaoSupport implements TournamentAnalyticsDao { @Override public TournamentAnalytics fetchByYear(Integer year) { TournamentAnalytics ret = null; String sql = "SELECT * FROM " + TABLE_NAME + " WHERE year = ?"; Object[] args = { year }; List<TournamentAnalytics> results = getJdbcTemplate().query(sql, args, new TournamentAnalyticsRowMapper()); if (results.size() > 0) { if (results.size() > 1) { log.warn("Expected 1 result from query, instead got " + results.size() + "!"); } ret = results.get(0); } else { log.warn("Requested year (" + year + ") does not exist in the DB!"); } return ret; } TournamentAnalyticsJdbcDao(DataSource dataSource); @Override TournamentAnalytics fetchByYear(Integer year);  }### Answer:
@Test @DisplayName("Testing fetchByYear()") public void fetchByYear() { assertAll( () -> { Integer year = 2010; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(44), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(101), tournamentAnalytics.getMaxScore()); }, () -> { Integer year = 2011; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(41), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(102), tournamentAnalytics.getMaxScore()); }, () -> { Integer year = 2012; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(41), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(102), tournamentAnalytics.getMaxScore()); }, () -> { Integer year = 2013; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(34), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(95), tournamentAnalytics.getMaxScore()); }, () -> { Integer year = 2014; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(35), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(93), tournamentAnalytics.getMaxScore()); }, () -> { Integer year = 2015; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(39), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(94), tournamentAnalytics.getMaxScore()); }, () -> { Integer year = 2016; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(43), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(105), tournamentAnalytics.getMaxScore()); }, () -> { Integer year = 2017; TournamentAnalytics tournamentAnalytics = classUnderTest.fetchByYear(year); assertNotNull(tournamentAnalytics); assertEquals(Integer.valueOf(39), tournamentAnalytics.getMinScore()); assertEquals(Integer.valueOf(103), tournamentAnalytics.getMaxScore()); }); }