001 /*****************************************************************************
002 * Copyright (C) NanoContainer Organization. All rights reserved. *
003 * ------------------------------------------------------------------------- *
004 * The software in this package is published under the terms of the BSD *
005 * style license a copy of which has been included with this distribution in *
006 * the LICENSE.txt file. *
007 * *
008 * Original code by *
009 *****************************************************************************/
010 /**
011 * @author Aslak Hellesøy
012 * @version $Revision: 1629 $
013 */
014 package org.nanocontainer.script;
015
016 import org.jmock.MockObjectTestCase;
017 import org.picocontainer.PicoContainer;
018 import org.picocontainer.defaults.ObjectReference;
019 import org.picocontainer.defaults.SimpleReference;
020
021 public abstract class AbstractScriptedContainerBuilderTestCase extends MockObjectTestCase {
022 private ObjectReference containerRef = new SimpleReference();
023 private ObjectReference parentContainerRef = new SimpleReference();
024
025 protected PicoContainer buildContainer(ScriptedContainerBuilder builder, PicoContainer parentContainer, Object scope) {
026 parentContainerRef.set(parentContainer);
027 builder.buildContainer(containerRef, parentContainerRef, scope, true);
028 return (PicoContainer) containerRef.get();
029 }
030 }