Package org.jbehave.junit

Source Code of org.jbehave.junit.JUnitMethodAdapterBehaviour$SomeBehaviourClass

/*
* Created on 13-Aug-2004
*
* (c) 2003-2004 ThoughtWorks Ltd
*
* See license.txt for license details
*/
package org.jbehave.junit;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import junit.framework.Test;

import org.jbehave.core.behaviour.BehaviourMethod;
import org.jbehave.core.mock.UsingMatchers;


/**
* @author <a href="mailto:dan.north@thoughtworks.com">Dan North</a>
*/
public class JUnitMethodAdapterBehaviour extends UsingMatchers {
    private static final List sequenceOfEvents = new ArrayList();
   
    public static class SomeBehaviourClass {
        public void shouldDoSomething() throws Exception {
            sequenceOfEvents.add("shouldDoSomething");
        }
    }
   
    public void shouldWrapMethodAsTestCase() throws Exception {
        // setup
        Method method = SomeBehaviourClass.class.getMethod("shouldDoSomething", null);
        Object instance = SomeBehaviourClass.class.newInstance();

        // execute
        Test test = new JUnitMethodAdapter(new BehaviourMethod(instance, method));
       
        // verify
        ensureThat(test, not(eq(null)));
    }
}
TOP

Related Classes of org.jbehave.junit.JUnitMethodAdapterBehaviour$SomeBehaviourClass

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.