예제 #1
0
 @Test
 public void should_sensor_msg_end_with_is_motionless_when_sensor_no_tripped_and_type_motion()
     throws Exception {
   // given
   sensor = new MotionSensor("1", "here", MOTION);
   // when
   final String sensorMessage = sensor.getSensorMessage();
   // then
   assertThat(sensorMessage.endsWith(" is motionless"), is(true));
 }
예제 #2
0
 @Test
 public void should_sensor_msg_end_with_is_sealed_when_sensor_no_tripped_and_type_window()
     throws Exception {
   // given
   sensor = new WindowSensor("1", "here", WINDOW);
   // when
   final String sensorMessage = sensor.getSensorMessage();
   // then
   assertThat(sensorMessage.endsWith(" is sealed"), is(true));
 }
예제 #3
0
 @Test
 public void should_sensor_msg_end_with_is_closed_when_sensor_no_tripped_and_type_door()
     throws Exception {
   // given
   sensor = new DoorSensor("1", "here", DOOR);
   // when
   final String sensorMessage = sensor.getSensorMessage();
   // then
   assertThat(sensorMessage.endsWith(" is closed"), is(true));
 }
예제 #4
0
 @Test
 public void should_sensor_msg_end_with_is_on_fire_when_sensor_tripped_and_type_fire()
     throws Exception {
   // given
   sensor = new FireSensor("1", "here", FIRE);
   // when
   sensor.trip();
   final String sensorMessage = sensor.getSensorMessage();
   // then
   assertThat(sensorMessage.endsWith(" is on FIRE!"), is(true));
 }
예제 #5
0
 @Test
 public void should_sensor_msg_start_with_motion_detected_in_when_sensor_tripped_and_type_motion()
     throws Exception {
   // given
   sensor = new MotionSensor("1", "here", MOTION);
   // when
   sensor.trip();
   final String sensorMessage = sensor.getSensorMessage();
   // then
   assertThat(sensorMessage.startsWith("Motion detected in "), is(true));
 }
예제 #6
0
 @Test
 public void
     should_sensor_msg_end_with_temperature_is_normal_when_sensor_no_tripped_and_type_fire()
         throws Exception {
   // given
   sensor = new FireSensor("1", "here", FIRE);
   // when
   final String sensorMessage = sensor.getSensorMessage();
   // then
   assertThat(sensorMessage.endsWith(" temperature is normal"), is(true));
 }