Package org.jbehave.core.mock

Examples of org.jbehave.core.mock.Mock


   
    public void shouldPassCaughtExceptionsToHandler() throws Exception {
        final QueuedObjectHolder exceptionHolder = new QueuedObjectHolder();
        final RuntimeException exception = new RuntimeException("An exception occurred");
       
        Mock handler = mock(ErrorHandler.class);
        handler.expects("handle").will(new InvocationHandler() {
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                exceptionHolder.set(args[0]);
                return null;
            }
        });
View Full Code Here


        char getChar();
        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

      int i = ((BehaviourInterface1)mock).getInt();
      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

        ensureThat(i, eq(1));
    }
   
    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

        ensureThat(i, eq(s));
     }
   
    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

        ensureThat(i, eq(b));
     }
   
    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

        ensureThat(i, eq(d, 0));
     }
   
    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

        ensureThat(i, eq(f, 0));
     }
   
    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

        ensureThat(i, eq(c));
     }
   
    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

        void doSomethingElse();
    }
   
    public void shouldCreateObjectThatCanBeCastToTheCorrectType() throws Exception {
        // given...
        Mock mock = MiniMockObject.mock(Foo.class, "foo");

        // verify...
        Ensure.that(mock instanceof Foo);
    }
View Full Code Here

TOP

Related Classes of org.jbehave.core.mock.Mock

Copyright © 2018 www.massapicom. 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.