### Question:
PostgisQueryParser { public static Parse parse(Layer layer, Query query) { String sql = query.getSql().replaceAll("\\s+"," ").trim(); Matcher matcher = QUERY_PATTERN.matcher(sql); if (!matcher.matches()) { throw new IllegalArgumentException("The SQL query is malformed"); } String select = matcher.group(1).trim(); String from = matcher.group(2).trim(); Optional<String> where = Optional.ofNullable(matcher.group(3)).map(s -> s.trim()); List<String> columns = split(select); if (columns.size() != 3) { throw new IllegalArgumentException("The SQL query malformed"); } String id = column(columns.get(0)); String tags = column(columns.get(1)); String geom = column(columns.get(2)); String source = "H" + Math.abs(Objects.hash(id, tags, geom, from)); return new Parse(layer, query, source, id, tags, geom, from, where); } private  PostgisQueryParser(); static Parse parse(Layer layer, Query query);  }### Answer:
@Test void parse() { for (TestQuery testQuery : testQueries) { Parse q1 = PostgisQueryParser.parse(new Layer(), testQuery.query); assertEquals(q1.getId(), testQuery.id); assertEquals(q1.getTags(), testQuery.tags); assertEquals(q1.getGeom(), testQuery.geom); assertEquals(q1.getFrom(), testQuery.from); assertEquals(q1.getWhere(), testQuery.where); } }