TeamExternalGroupDaoImpl implements TeamExternalGroupDao { @Override public List<TeamExternalGroup> getByTeamIdentifier(String identifier) { Object[] args = {identifier}; try { String s = "SELECT teg.id AS teg_id, teg.grouper_team_id, eg.id AS eg_id, eg.identifier, eg.name, eg.description, eg.group_provider " + " FROM team_external_groups AS teg " + " INNER JOIN external_groups AS eg " + " ON teg.external_groups_id = eg.id " + " WHERE teg.grouper_team_id = ? "; return this.jdbcTemplate.query(s, args, new RowMapper<TeamExternalGroup>() { @Override public TeamExternalGroup mapRow(ResultSet rs, int rowNum) throws SQLException { return mapRowToTeamExternalGroup(rs); } }); } catch (EmptyResultDataAccessException er) { return null; } }  void setJdbcTemplate(JdbcTemplate tpl); @Override ExternalGroup getExternalGroupByIdentifier(String identifier); @Override List<TeamExternalGroup> getByTeamIdentifier(String identifier); @Override List<TeamExternalGroup> getByExternalGroupIdentifier(String identifier); @Override TeamExternalGroup getByTeamIdentifierAndExternalGroupIdentifier(String teamId, String externalGroupIdentifier); @Override void saveOrUpdate(TeamExternalGroup teamExternalGroup); @Override void delete(TeamExternalGroup teamExternalGroup); @Override List<TeamExternalGroup> getByExternalGroupIdentifiers(Collection<String> identifiers);  }
@Test public void testGetByTeamIdentifier() throws Exception { String teamId = TEAM_JASHA; final List<TeamExternalGroup> teamExternalGroups = teamExternalGroupDao.getByTeamIdentifier(teamId); assertFalse(teamExternalGroups.isEmpty()); final TeamExternalGroup teamExternalGroup = teamExternalGroups.get(0); assertTrue(teamExternalGroup.getId() == 1001L); final ExternalGroup externalGroup = teamExternalGroup.getExternalGroup(); assertTrue(externalGroup.getId() == 1L); assertEquals(AVANS_GROUP_IDENT, externalGroup.getIdentifier()); }
@Test public void testGetByTeamIdentifier_emptyList() throws Exception { String teamId = "nl:surfnet:diensten:team_stein"; final List<TeamExternalGroup> teamExternalGroups = teamExternalGroupDao.getByTeamIdentifier(teamId); assertTrue(teamExternalGroups.isEmpty()); }