### Question:
ToolVersionDao extends NamedParameterJdbcDaoSupport { public Optional<ToolVersion> loadToolVersion(Long toolId, String version) { return getJdbcTemplate() .query(loadToolVersionQuery, ToolVersionParameters.getRowMapper(), toolId, version) .stream() .findFirst(); }  @Required void setToolVersionSequenceQuery(String toolVersionSequenceQuery); @Required void setCreateToolVersionQuery(String createToolVersionQuery); @Required void setUpdateToolVersionQuery(String updateToolVersionQuery); @Required void setDeleteToolVersionsQuery(String deleteToolVersionsQuery); @Required void setDeleteToolVersionQuery(String deleteToolVersionQuery); @Required void setLoadToolVersionQuery(String loadToolVersionQuery); @Required void setLoadToolVersionSettingsQuery(String loadToolVersionSettingsQuery); @Required void setCreateToolVersionWithSettingsQuery(String createToolVersionWithSettingsQuery); @Required void setUpdateToolVersionWithSettingsQuery(String updateToolVersionWithSettingsQuery); @Required void setLoadToolSettingsQuery(final String loadToolSettingsQuery); @Transactional(propagation = Propagation.MANDATORY) void createToolVersion(ToolVersion toolVersion); @Transactional(propagation = Propagation.MANDATORY) void updateToolVersion(ToolVersion toolVersion); @Transactional(propagation = Propagation.MANDATORY) void deleteToolVersion(Long toolId, String version); @Transactional(propagation = Propagation.MANDATORY) void deleteToolVersions(Long toolId); Optional<ToolVersion> loadToolVersion(Long toolId, String version); List<ToolVersion> loadToolWithSettings(Long toolId); Optional<ToolVersion> loadToolVersionWithSettings(Long toolId, String version); @Transactional(propagation = Propagation.MANDATORY) void createToolVersionWithSettings(ToolVersion toolVersion); @Transactional(propagation = Propagation.MANDATORY) void updateToolVersionWithSettings(ToolVersion toolVersion);  }### Answer:
@Test @Transactional public void testLoadToolVersionWorksForRegularTool() { final List<ToolVersion> expectedVersions = Arrays.asList(toolVersion1, toolVersion2); expectedVersions.forEach(toolVersionDao::createToolVersion); final List<ToolVersion> actualVersions = expectedVersions.stream() .map(version -> toolVersionDao.loadToolVersion(tool.getId(), version.getVersion())) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.toList()); assertVersions(actualVersions, expectedVersions); }
@Test @Transactional public void testLoadToolVersionWorksForSymlink() { final List<ToolVersion> expectedVersions = Arrays.asList(toolVersion1, toolVersion2); expectedVersions.forEach(toolVersionDao::createToolVersion); final List<ToolVersion> actualVersions = expectedVersions.stream() .map(version -> toolVersionDao.loadToolVersion(symlink.getId(), version.getVersion())) .filter(Optional::isPresent) .map(Optional::get) .collect(Collectors.toList()); assertVersions(actualVersions, expectedVersions); }