/***************************************************************************
 * <PRE>
 * File:        $Id$
 * Module:      swtlayeredgraph
 * Authors:     davija
 * Last mod:    $Author$ at $Date$
 *
 * Copyright (C) 2008-2009 by James Davis                                     
 * davija@cshp.info                                                      
 *                                                                         
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 3 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 * </PRE>
 ***************************************************************************/

package info.cshp.swtlayeredgraph;


import org.junit.Test;
import org.unitils.UnitilsJUnit4;
import org.unitils.mock.Mock;

/**
 * @author davija
 */
public class UnitilsBugTestCase extends UnitilsJUnit4
{
    private Mock<InnerClass> mockInner;
    private Mock<OuterClass> mockOuter;

    private class InnerClass
    {
        public InnerClass()
        {}

        public String testMe()
        {
            return "Testing";
        }
    };

    private class OuterClass
    {
        private InnerClass inner = null; ;

        public OuterClass(InnerClass inner)
        {
            this.inner = inner;
        }

        public InnerClass getInner()
        {
            return inner;
        }
    };

    @Test
    public void testCase()
    {
        mockInner.returns("Test2").testMe();
        mockOuter.returns(mockInner.getMock()).getInner();

        for (int i = 0; i < 20; i++)
        {
            System.out.println(i + ": " + mockOuter.getMock().getInner().testMe());
        }
    }
}
