PathCreator { public String[] findVars(final String path) { final List<String> vars = new ArrayList<>(); final char[] arr = path.toCharArray(); char lastChar = 0; int start = -1; for (int i = 0; i < arr.length; i++) { final char c = arr[i]; if (start == -1 && c == '{' && lastChar == '$') { start = i + 1; } else if (start != -1 && c == '}') { vars.add(new String(arr, start, i - start)); start = -1; } lastChar = c; } return vars.toArray(new String[0]); } @Inject  PathCreator(final TempDirProvider tempDirProvider); String replaceTimeVars(String path); String replaceSystemProperties(String path); String replaceUUIDVars(String path); String replaceFileName(String path, final String fileName); String[] findVars(final String path); String replace(final String path,
                          final String type,
                          final Supplier<String> replacementSupplier); String replaceAll(String path); String replaceContextVars(String path);  }
@Test void testFindVars(@TempDir Path tempDir) { final PathCreator pathCreator = new PathCreator(() -> tempDir); final String[] vars = pathCreator.findVars("/temp/${feed}-FLAT/${pipe}_less-${uuid}/${searchId}"); assertThat(vars.length).isEqualTo(4); assertThat(vars[0]).isEqualTo("feed"); assertThat(vars[1]).isEqualTo("pipe"); assertThat(vars[2]).isEqualTo("uuid"); assertThat(vars[3]).isEqualTo("searchId"); }