Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. package ss.week2.test;
  2. import ss.week2.ThreeWayLamp;
  3. import ss.week2.ThreeWayLamp.state;
  4.  
  5. public class ThreeWayLampTest {
  6. public static void main(String[] args) {
  7.  
  8. ThreeWayLamp newLamp = new ThreeWayLamp();
  9. Boolean startsAtOff = newLamp.getValue() == state.OFF; //this checks if it starts at OFF
  10. state[] array = state.values();
  11. Boolean sequenceCorrect = true;
  12. for (int i = 1; i < 5; i++) {
  13. newLamp.nextValue();
  14. if (newLamp.getValue() != array[i % 4])
  15. {
  16. sequenceCorrect = false;
  17. } //This for-loop checks if the sequence in nextValue() is in the right order
  18. }
  19. System.out.println(startsAtOff + " " + sequenceCorrect);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement