Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ss.week2.test;
- import ss.week2.ThreeWayLamp;
- import ss.week2.ThreeWayLamp.state;
- public class ThreeWayLampTest {
- public static void main(String[] args) {
- ThreeWayLamp newLamp = new ThreeWayLamp();
- Boolean startsAtOff = newLamp.getValue() == state.OFF; //this checks if it starts at OFF
- state[] array = state.values();
- Boolean sequenceCorrect = true;
- for (int i = 1; i < 5; i++) {
- newLamp.nextValue();
- if (newLamp.getValue() != array[i % 4])
- {
- sequenceCorrect = false;
- } //This for-loop checks if the sequence in nextValue() is in the right order
- }
- System.out.println(startsAtOff + " " + sequenceCorrect);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement