Example #1
0
  @Test
  public void check_should_set_alarm_off_when_pressure_is_in_range() {
    when(sensorMock.popNextPressurePsiValue()).thenReturn(17.00);

    alarm.check();

    assertThat(alarm.isAlarmOn(), is(false));

    when(sensorMock.popNextPressurePsiValue()).thenReturn(21.00);

    alarm.check();

    assertThat(alarm.isAlarmOn(), is(false));
  }
Example #2
0
  @Test
  public void check_should_set_alarm_on_when_pressure_falls_down_range() {
    when(sensorMock.popNextPressurePsiValue()).thenReturn(16.00);

    alarm.check();

    assertThat(alarm.isAlarmOn(), is(true));
  }
Example #3
0
 @Test
 public void isAlarmOn_should_be_false_for_a_new_alarm_instance() {
   assertEquals(false, alarm.isAlarmOn());
 }