HttpPathUtils { public static Map<String, Set<String>> extractAttributesByPath(String path) { return Stream.of(path.split(REGEX_ATTRIBUTE)[1].split(REGEX_ATTRIBUTE_CONCAT)) .map(e -> e.split(DELIMITER_ATTRIBUTE_KEY_VALUE)) .collect(Collectors.toMap(e -> e[0], e -> e.length > 1 && e[1] != null ? Stream.of(e[1].split(DELIMITER_ATTRIBUTES)).collect(Collectors.toSet()) : Collections.emptySet())); }  static String toPath(String first, String... rest); static HttpPathMethodDTO readServerPathDTO(String configurationJson); static ServerPathConfig toHttpPathConfig(HttpPathMethodDTO dto, RoboReference<Object> reference); static ClientPathConfig toClientPathConfig(HttpPathMethodDTO dto); static void updateHttpServerContextPaths(final RoboContext context, final ServerContext serverContext,
			final Collection<HttpPathMethodDTO> paths); static void updateHttpClientContextPaths(final ClientContext clientContext,
			final Collection<HttpPathMethodDTO> paths); static Map<String, Set<String>> extractAttributesByPath(String path); static final String ATTRIBUTES_PATH_VALUE; static final String DELIMITER_ATTRIBUTE_KEY_VALUE; static final String DELIMITER_ATTRIBUTES; static final String DELIMITER_PATH_ATTRIBUTES; static final String REGEX_ATTRIBUTE; static final String REGEX_ATTRIBUTE_CONCAT; }
@Test void parseGetRequestWithAttributes(){ String path = "/units/controller?attributes=number,counter"; Map<String, Set<String>> expectedMap = new HashMap<>(); Set<String> expectedAttributesValues = new HashSet<>(); String attributeName = "attributes"; expectedAttributesValues.add("number"); expectedAttributesValues.add("counter"); expectedMap.put(ATTRIBUTES_PATH_VALUE, expectedAttributesValues); HttpPathUtils.extractAttributesByPath(path); Map<String, Set<String>> attributeMap = HttpPathUtils.extractAttributesByPath(path); assertArrayEquals(attributeMap.get(attributeName).toArray(), expectedMap.get(attributeName).toArray()); }