@SuppressWarnings("serial")
  public List<CandidateSteps> groovySteps() {
    final DefaultClassLoadingPicoContainer container =
        new DefaultClassLoadingPicoContainer(
            new ThreadCaching()
                .wrap(
                    new CompositeInjection(
                        new ConstructorInjection(),
                        new SetterInjection().withInjectionOptional())));
    container.change(Characteristics.USE_NAMES);
    container.addComponent(WebDriverProvider.class, driverProvider);
    // This loads all the Groovy classes in pages.*

    container.visit(
        new ClassName("pages.Home"),
        ".*\\.class",
        true,
        new DefaultClassLoadingPicoContainer.ClassVisitor() {
          public void classFound(Class clazz) {
            container.addComponent(clazz);
          }
        });

    ClassLoadingPicoContainer steps = container.makeChildContainer("steps");
    steps.addComponent(new ClassName("housekeeping.EmptyCartIfNotAlready"));
    steps.addComponent(new ClassName("EtsyDotComSteps"));

    return new PicoStepsFactory(configuration, steps).createCandidateSteps();
  }
  @Test
  public void testBuildContainerWithParentAttribute() {
    DefaultClassLoadingPicoContainer parent = new DefaultClassLoadingPicoContainer();
    parent.addComponent("hello", "world");

    Reader script =
        new StringReader(
            "A = org.picocontainer.script.testmodel.A\n"
                + "container(:parent => $parent) {\n"
                + "    component(A)\n"
                + "}\n");

    PicoContainer pico = buildContainer(script, parent, ASSEMBLY_SCOPE);
    // Should be able to get instance that was registered in the parent container
    assertEquals("world", pico.getComponent("hello"));
  }
  @Test
  public void testBuildContainerWithParentDependencyAndAssemblyScope() throws Exception {
    DefaultClassLoadingPicoContainer parent = new DefaultClassLoadingPicoContainer();
    parent.addComponent("a", A.class);

    String source =
        "B = org.picocontainer.script.testmodel.B\n"
            + "SomeAssemblyScope = org.picocontainer.script.testmodel.SomeAssemblyScope\n"
            + "container(:parent => $parent) {\n"
            + "  if $assembly_scope.kind_of?(SomeAssemblyScope)\n "
            + "    component(B)\n"
            + "  end\n "
            + "}\n";

    Reader script = new StringReader(source);

    PicoContainer pico = buildContainer(script, parent, new SomeAssemblyScope());
    assertNotNull(pico.getComponent(B.class));

    script = new StringReader(source);
    pico = buildContainer(script, parent, ASSEMBLY_SCOPE);
    assertNull(pico.getComponent(B.class));
  }