示例#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));
  }
示例#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));
  }