test_class.file: web/api/src/test/java/leap/web/api/query/GroupByParserTest.java
test_class.identifier: GroupByParserTest
test_class.superclass: extends TestBase
test_case.body: @Test
      public void testMulti() {
          GroupBy groupBy = GroupByParser.parse("id,name");
          assertEquals(2, groupBy.items().length);
          assertGroupBy(groupBy.items()[0], "id", null, null);
          assertGroupBy(groupBy.items()[1], "name", null, null);
          groupBy = GroupByParser.parse("id i,name n");
          assertGroupBy(groupBy.items()[0], "id", "i", null);
          assertGroupBy(groupBy.items()[1], "name", "n", null);
          groupBy = GroupByParser.parse("t.id i,t.name n");
          assertGroupBy(groupBy.items()[0], "id", "i", "t");
          assertGroupBy(groupBy.items()[1], "name", "n", "t");
      }
test_case.class_method_signature: GroupByParserTest.testMulti()
test_case.full_signature: @Test public void testMulti()
test_case.identifier: testMulti
test_case.invocations: parse assertEquals items assertGroupBy items assertGroupBy items parse assertGroupBy items assertGroupBy items parse assertGroupBy items assertGroupBy items
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMulti()
focal_class.file: web/api/src/main/java/leap/web/api/query/GroupByParser.java
focal_class.identifier: GroupByParser
focal_class.class_method_signature: GroupByParser.parse(String expr)
focal_class.full_signature: public static GroupBy parse(String expr)
focal_class.identifier: parse
focal_class.modifiers: public static
focal_class.parameters: (String expr)
focal_class.return: GroupBy
focal_class.signature: GroupBy parse(String expr)
focal_method.body: public static GroupBy parse(String expr) {
          List<GroupBy.Item> items = new ArrayList<>();
          GroupBy.Item item;
          String[] names = Strings.split(expr, ',');
          for (String name : names) {
              String[] parts = Strings.splitWhitespaces(name);
              if (parts.length <= 2) {
                  String[] join = Strings.split(parts[0], ".");
                  if (join.length == 1) {
                      if (parts.length == 1) {
                          item = new GroupBy.Item(parts[0]);
                      } else {
                          item = new GroupBy.Item(parts[0], parts[1]);
                      }
                  } else if (join.length == 2) {
                      if (parts.length == 1) {
                          item = new GroupBy.Item(join[1], null, join[0]);
                      } else {
                          item = new GroupBy.Item(join[1], parts[1], join[0]);
                      }
                  } else {
                      throw new BadRequestException("Invalid join item '" + parts[0] + "'");
                  }
              } else {
                  throw new BadRequestException("Invalid select item '" + name + "'");
              }
              items.add(item);
          }
          return new GroupBy(items.toArray(new GroupBy.Item[items.size()]));
      }
focal_method.class_method_signature: GroupByParser.parse(String expr)
focal_method.full_signature: public static GroupBy parse(String expr)
focal_method.identifier: parse
focal_method.invocations: split splitWhitespaces split add toArray size
focal_method.modifiers: public static
focal_method.parameters: (String expr)
focal_method.return: GroupBy
focal_method.signature: GroupBy parse(String expr)