Package org.jbehave.classmock

Source Code of org.jbehave.classmock.UsingClassMockBehaviour

package org.jbehave.classmock;

import java.util.HashMap;

import org.jbehave.core.minimock.UsingMiniMock;
import org.jbehave.core.mock.Mock;


public class UsingClassMockBehaviour extends UsingMiniMock {

  UsingClassMock classMock = new UsingClassMock();
 
  public void shouldBeAbleToMockClasses() {
    Object expected = new Object();

    Mock mock = classMock.mock(HashMap.class);
    mock.expects("get").with(anything()).will(returnValue(expected));
   
    Object actual = ((HashMap)mock).get("some key");
    ensureThat(expected, eq(actual));
  }
 
  public void shouldBeAbleToStubClasses() {
        Object expected = new Object();

        Mock mock = classMock.mock(HashMap.class);
        mock.stubs("get").will(returnValue(expected));
       
        Object actual = ((HashMap)mock).get("some key");
        ensureThat(expected, eq(actual));
  }
}
TOP

Related Classes of org.jbehave.classmock.UsingClassMockBehaviour

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.