示例#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));
  }
示例#3
0
文件: TestAlarm.java 项目: Egga/katas
 @Test
 public void foo() {
   Alarm alarm = new Alarm();
   assertEquals(false, alarm.isAlarmOn());
 }
示例#4
0
 @Test
 public void isAlarmOn_should_be_false_for_a_new_alarm_instance() {
   assertEquals(false, alarm.isAlarmOn());
 }