Package org.squirrelframework.foundation.component

Examples of org.squirrelframework.foundation.component.Heartbeat


    }

    @Test
    public void testHeartBeat() {
        InOrder callSequence = Mockito.inOrder(methodCalls);
        Heartbeat hb = SquirrelProvider.getInstance().newInstance(Heartbeat.class);
        hb.begin();
        hb.defer(new Runnable() {
            @Override
            public void run() {
                methodCalls.method1();
            }
        });
        hb.defer(new Runnable() {
            @Override
            public void run() {
                methodCalls.method3();
            }
        });
        callSequence.verify(methodCalls, Mockito.times(0)).method1();
        callSequence.verify(methodCalls, Mockito.times(0)).method2();
        callSequence.verify(methodCalls, Mockito.times(0)).method3();
        callSequence.verify(methodCalls, Mockito.times(0)).method4();
        hb.begin();
        hb.defer(new Runnable() {
            @Override
            public void run() {
                methodCalls.method2();
            }
        });
        hb.defer(new Runnable() {
            @Override
            public void run() {
                methodCalls.method4();
            }
        });
        callSequence.verify(methodCalls, Mockito.times(0)).method1();
        callSequence.verify(methodCalls, Mockito.times(0)).method2();
        callSequence.verify(methodCalls, Mockito.times(0)).method3();
        callSequence.verify(methodCalls, Mockito.times(0)).method4();
        hb.execute();
        callSequence.verify(methodCalls, Mockito.times(0)).method1();
        callSequence.verify(methodCalls, Mockito.times(1)).method2();
        callSequence.verify(methodCalls, Mockito.times(0)).method3();
        callSequence.verify(methodCalls, Mockito.times(1)).method4();
        hb.execute();
        callSequence.verify(methodCalls, Mockito.times(1)).method1();
        callSequence.verify(methodCalls, Mockito.times(0)).method2();
        callSequence.verify(methodCalls, Mockito.times(1)).method3();
        callSequence.verify(methodCalls, Mockito.times(0)).method4();
    }
View Full Code Here

TOP

Related Classes of org.squirrelframework.foundation.component.Heartbeat

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.