public static ImmutableList<SbeField> generateFields(Ir ir, IrOptions irOptions) {
    ImmutableList.Builder<SbeField> fields = ImmutableList.builder();

    TokenIterator iterator = getIteratorForMessage(ir, irOptions);
    while (iterator.hasNext()) {
      Token token = iterator.next();
      switch (token.signal()) {
        case BEGIN_FIELD:
          fields.add(processPrimitive(iterator));
          break;
        default:
          // TODO(https://github.com/apache/beam/issues/21102): Support remaining field types
          break;
      }
    }

    return fields.build();
  }
@Test
  public void testGenerateFieldsNoSpecifiedMessage() throws Exception {
    Ir ir = getIr(OnlyPrimitivesMultiMessage.RESOURCE_PATH);

    assertThrows(
        IllegalArgumentException.class,
        () -> IrFieldGenerator.generateFields(ir, IrOptions.DEFAULT));
  }