Examples of stubs()


Examples of org.jbehave.core.mock.Mock.stubs()

 
  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));
  }
}
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

        boolean getBoolean();
    }
   
    public void shouldCreateCorrectReturnValueForPrimitiveInt() throws Exception {
      Mock mock = m.mock(BehaviourInterface1.class);
      mock.stubs("getInt").will(m.returnValue(1));
  
      int i = ((BehaviourInterface1)mock).getInt();
      ensureThat(i, eq(1));
    }
   
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

      ensureThat(i, eq(1));
    }
   
    public void shouldCreateCorrectReturnValueForPrimitiveLong() throws Exception {
        Mock mock = m.mock(BehaviourInterface1.class);
        mock.stubs("getLong").will(m.returnValue(1l));
    
        long i = ((BehaviourInterface1)mock).getLong();
        ensureThat(i, eq(1));
    }
   
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

    }
   
    public void shouldCreateCorrectReturnValueForPrimitiveShort() throws Exception {
        short s = 2;
        Mock mock = m.mock(BehaviourInterface1.class);
        mock.stubs("getShort").will(m.returnValue(s));
    
        short i = ((BehaviourInterface1)mock).getShort();
        ensureThat(i, eq(s));
     }
   
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

     }
   
    public void shouldCreateCorrectReturnValueForPrimitiveByte() throws Exception {
        byte b = 3;
        Mock mock = m.mock(BehaviourInterface1.class);
        mock.stubs("getByte").will(m.returnValue(b));
    
        byte i = ((BehaviourInterface1)mock).getByte();
        ensureThat(i, eq(b));
     }
   
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

     }
   
    public void shouldCreateCorrectReturnValueForPrimitiveDouble() throws Exception {
        double d = 4;
        Mock mock = m.mock(BehaviourInterface1.class);
        mock.stubs("getDouble").will(m.returnValue(d));
    
        double i = ((BehaviourInterface1)mock).getDouble();
        ensureThat(i, eq(d, 0));
     }
   
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

     }
   
    public void shouldCreateCorrectReturnValueForPrimitiveFloat() throws Exception {
        float f = 4;
        Mock mock = m.mock(BehaviourInterface1.class);
        mock.stubs("getFloat").will(m.returnValue(f));
    
        float i = ((BehaviourInterface1)mock).getFloat();
        ensureThat(i, eq(f, 0));
     }
   
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

     }
   
    public void shouldCreateCorrectReturnValueForPrimitiveChar() throws Exception {
        char c = 4;
        Mock mock = m.mock(BehaviourInterface1.class);
        mock.stubs("getChar").will(m.returnValue(c));
    
        char i = ((BehaviourInterface1)mock).getChar();
        ensureThat(i, eq(c));
     }
   
View Full Code Here

Examples of org.jbehave.core.mock.Mock.stubs()

     }
   
    public void shouldCreateCorrectReturnValueForPrimitiveBoolean() throws Exception {
        boolean b = true;
        Mock mock = m.mock(BehaviourInterface1.class);
        mock.stubs("getBoolean").will(m.returnValue(b));
    
        boolean i = ((BehaviourInterface1)mock).getBoolean();
        ensureThat(i, eq(b));
     }
}
View Full Code Here

Examples of org.jmock.Mock.stubs()

    {
        super.setUp();

        Mock mockXWiki = mock(XWiki.class, new Class[] {}, new Object[] {});

        mockXWiki.stubs().method("getCacheFactory").will(returnValue(cacheFactory));
        mockXWiki.stubs().method("getXWikiPreference").will(returnValue(null));
        mockXWiki.stubs().method("getXWikiPreferenceAsInt").will(throwException(new NumberFormatException("null")));
        mockXWiki.stubs().method("Param").will(new CustomStub("Implements XWiki.Param")
        {
            public Object invoke(Invocation invocation) throws Throwable
View Full Code Here
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.