### Question:
DataSetUtil { @Nonnull public static Optional<List<String>> getPaths(@Nonnull final DataSet dataSet) { final DataSetTemplate connectorTemplate = Optional.of(dataSet).map(DataSet::getDataSource).map(DataSource::getConnector).map(Connector::getTemplate).orElse(null); final DataSetTemplate dataSetTemplate = Optional.of(dataSet).map(DataSet::getDataSource).map(DataSource::getTemplate).orElse(null); List<String> paths = new ArrayList<>(); if (dataSet.getOptions() != null && dataSet.getOptions().get("path") != null) { paths.add(dataSet.getOptions().get("path")); } else if (dataSetTemplate != null && dataSetTemplate.getOptions() != null && dataSetTemplate.getOptions().get("path") != null) { paths.add(dataSetTemplate.getOptions().get("path")); } else if (connectorTemplate != null && connectorTemplate.getOptions() != null && connectorTemplate.getOptions().get("path") != null) { paths.add(connectorTemplate.getOptions().get("path")); } if (dataSet.getPaths() != null) { paths.addAll(dataSet.getPaths()); } else if (dataSetTemplate != null && dataSetTemplate.getPaths() != null) { paths.addAll(dataSetTemplate.getPaths()); } else if (connectorTemplate != null && connectorTemplate.getPaths() != null) { paths.addAll(connectorTemplate.getPaths()); } else if (paths.isEmpty()) { paths = null; } return Optional.ofNullable(paths); } private  DataSetUtil(); @Nonnull static Configuration getConfiguration(@Nonnull final DataSetTemplate template, @Nullable final Configuration parent); @Nonnull static Optional<List<String>> getPaths(@Nonnull final DataSet dataSet); @Nonnull static DefaultDataSetTemplate mergeTemplates(@Nonnull final DataSet dataSet); static void mergeTemplates(@Nonnull final DefaultDataSetTemplate dst, @Nonnull final DataSetTemplate src);  }### Answer:
@Test public void getPaths() { final DefaultDataSetTemplate connectorTemplate = new DefaultDataSetTemplate(); connectorTemplate.setOptions(Collections.singletonMap("path", "connector1.txt")); connectorTemplate.setPaths(Collections.singletonList("connector2.txt")); final Connector connector = new Connector(); connector.setTemplate(connectorTemplate); final DefaultDataSetTemplate dataSourceTemplate = new DefaultDataSetTemplate(); dataSourceTemplate.setOptions(Collections.singletonMap("path", "datasource1.txt")); dataSourceTemplate.setPaths(Collections.singletonList("datasource2.txt")); final DataSource dataSource = new DataSource(); dataSource.setConnector(connector); dataSource.setTemplate(dataSourceTemplate); final DataSet dataSet = new DataSet(); dataSet.setDataSource(dataSource); dataSet.setOptions(Collections.singletonMap("path", "dataset1.txt")); dataSet.setPaths(Collections.singletonList("dataset2.txt")); Assert.assertEquals(Arrays.asList("dataset1.txt", "dataset2.txt"), DataSetUtil.getPaths(dataSet).orElse(null)); dataSet.setOptions(null); Assert.assertEquals(Arrays.asList("datasource1.txt", "dataset2.txt"), DataSetUtil.getPaths(dataSet).orElse(null)); dataSet.setPaths(null); Assert.assertEquals(Arrays.asList("datasource1.txt", "datasource2.txt"), DataSetUtil.getPaths(dataSet).orElse(null)); dataSourceTemplate.setOptions(null); Assert.assertEquals(Arrays.asList("connector1.txt", "datasource2.txt"), DataSetUtil.getPaths(dataSet).orElse(null)); dataSourceTemplate.setPaths(null); Assert.assertEquals(Arrays.asList("connector1.txt", "connector2.txt"), DataSetUtil.getPaths(dataSet).orElse(null)); connectorTemplate.setOptions(null); connectorTemplate.setPaths(null); Assert.assertEquals(Optional.empty(), DataSetUtil.getPaths(dataSet)); }