@Test public void test1() { Elevator lift = new Elevator(); int button = 3; boolean expected = lift.call("Up"); Assertions.assertEquals(expected, true); }
public boolean call(String button) { int begin = getAFloor(); int end = getAFloor(); int buttonPressedFloor = getAFloor(); if (button.equalsIgnoreCase("Up")) { return (begin <= buttonPressedFloor && buttonPressedFloor < end) || (begin < buttonPressedFloor && buttonPressedFloor <= end); } else return (begin >= buttonPressedFloor && buttonPressedFloor > end) || (begin > buttonPressedFloor && buttonPressedFloor >= end); }
Elevator { public boolean call(String button) { int begin = getAFloor(); int end = getAFloor(); int buttonPressedFloor = getAFloor(); if (button.equalsIgnoreCase("Up")) { return (begin <= buttonPressedFloor && buttonPressedFloor < end) || (begin < buttonPressedFloor && buttonPressedFloor <= end); } else return (begin >= buttonPressedFloor && buttonPressedFloor > end) || (begin > buttonPressedFloor && buttonPressedFloor >= end); } }
Elevator { public boolean call(String button) { int begin = getAFloor(); int end = getAFloor(); int buttonPressedFloor = getAFloor(); if (button.equalsIgnoreCase("Up")) { return (begin <= buttonPressedFloor && buttonPressedFloor < end) || (begin < buttonPressedFloor && buttonPressedFloor <= end); } else return (begin >= buttonPressedFloor && buttonPressedFloor > end) || (begin > buttonPressedFloor && buttonPressedFloor >= end); }  }
Elevator { public boolean call(String button) { int begin = getAFloor(); int end = getAFloor(); int buttonPressedFloor = getAFloor(); if (button.equalsIgnoreCase("Up")) { return (begin <= buttonPressedFloor && buttonPressedFloor < end) || (begin < buttonPressedFloor && buttonPressedFloor <= end); } else return (begin >= buttonPressedFloor && buttonPressedFloor > end) || (begin > buttonPressedFloor && buttonPressedFloor >= end); }  boolean call(String button); }
Elevator { public boolean call(String button) { int begin = getAFloor(); int end = getAFloor(); int buttonPressedFloor = getAFloor(); if (button.equalsIgnoreCase("Up")) { return (begin <= buttonPressedFloor && buttonPressedFloor < end) || (begin < buttonPressedFloor && buttonPressedFloor <= end); } else return (begin >= buttonPressedFloor && buttonPressedFloor > end) || (begin > buttonPressedFloor && buttonPressedFloor >= end); }  boolean call(String button);  }