Package org.tomighty.bus.messages.timer

Examples of org.tomighty.bus.messages.timer.TimerTick


    }

    private void tick() {
        state.decreaseOneSecond();

        bus.publish(new TimerTick(state.getTime(), state.getPhase()));

        if(state.getTime().isZero())
            finish();
    }
View Full Code Here


        TimerStarted timerStarted = (TimerStarted) messages.get(0);
        assertEquals("Initial time", Time.seconds(3), timerStarted.getTime());
        assertEquals("Phase when timer started", Phase.POMODORO, timerStarted.getPhase());

        TimerTick firstTick = (TimerTick) messages.get(1);
        assertEquals("First tick's time", Time.seconds(2), firstTick.getTime());
        assertEquals("First tick's phase", Phase.POMODORO, firstTick.getPhase());

        TimerTick secondTick = (TimerTick) messages.get(2);
        assertEquals("Second tick's time", Time.seconds(1), secondTick.getTime());
        assertEquals("Second tick's phase", Phase.POMODORO, secondTick.getPhase());

        TimerTick thirdTick = (TimerTick) messages.get(3);
        assertEquals("Third tick's time", Time.seconds(0), thirdTick.getTime());
        assertEquals("Third tick's phase", Phase.POMODORO, thirdTick.getPhase());
       
        TimerFinished timerFinished = (TimerFinished) messages.get(4);
        assertEquals("Phase when timer finished", Phase.POMODORO, timerFinished.getPhase());
    }
View Full Code Here

        TimerStarted timerStarted = (TimerStarted) messages.get(0);
        assertEquals("Initial time", Time.seconds(3), timerStarted.getTime());
        assertEquals("Phase when timer started", Phase.BREAK, timerStarted.getPhase());

        TimerTick tick = (TimerTick) messages.get(1);
        assertEquals("Tick's time", Time.seconds(2), tick.getTime());
        assertEquals("Tick's phase", Phase.BREAK, tick.getPhase());

        TimerInterrupted timerInterrupted = (TimerInterrupted) messages.get(2);
        assertEquals("Time when timer was interrupted", Time.seconds(2), timerInterrupted.getTime());
        assertEquals("Phase when timer was interrupted", Phase.BREAK, timerInterrupted.getPhase());
    }
View Full Code Here

TOP

Related Classes of org.tomighty.bus.messages.timer.TimerTick

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.