private void buildFixtureMethod(MethodNode method) {
    FixtureMethod fixtureMethod = new FixtureMethod(spec, method);

    Block block = new AnonymousBlock(fixtureMethod);
    fixtureMethod.addBlock(block);
    List<Statement> stats = AstUtil.getStatements(method);
    block.getAst().addAll(stats);
    stats.clear();

    String name = method.getName();
    switch (name) {
      case SETUP:
        spec.setSetupMethod(fixtureMethod);
        break;
      case CLEANUP:
        spec.setCleanupMethod(fixtureMethod);
        break;
      case SETUP_SPEC_METHOD:
        spec.setSetupSpecMethod(fixtureMethod);
        break;
      default:
        spec.setCleanupSpecMethod(fixtureMethod);
        break;
    }
  }
Given the abstract syntax tree of a Groovy class representing a Spock
specification, builds an object model of the specification.

@author Peter Niederwieser
spock-core/src/main/java/org/spockframework/compiler/SpecParser.java