HotColdTemperature: Fix warm-but-colder temperature bug
Because the word "cold" is used both as a temperature ("The device is
cold"), and in a temperature change ("but colder than last time."),
HotColdTemperature tried to interpret COLDER temperature changes as a
COLD temperature match. By matching only the section of the temperature
string preceding the optional comma, this bug is avoided.
This commit is contained in:
@@ -73,5 +73,7 @@ public class HotColdTemperatureTest
|
||||
assertEquals(HotColdTemperature.ICE_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is ice cold."));
|
||||
assertEquals(HotColdTemperature.VERY_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very cold."));
|
||||
assertEquals(HotColdTemperature.VERY_HOT, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very hot."));
|
||||
assertEquals(HotColdTemperature.COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, "The device is cold, and warmer than last time."));
|
||||
assertEquals(HotColdTemperature.WARM, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, "The device is warm, but colder than last time."));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user