@@ -34,12 +34,12 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification {
34
34
def data = new TimeBasedWeatherValueData (parameter, coordinate)
35
35
36
36
def expectedResults = new TimeBasedValue (
37
- time, new WeatherValue (coordinate,
38
- Quantities . getQuantity( 286.872985839844d , StandardUnits . SOLAR_IRRADIANCE ),
39
- Quantities . getQuantity( 282.671997070312d , StandardUnits . SOLAR_IRRADIANCE ),
40
- null ,
41
- Quantities . getQuantity( 0d , StandardUnits . WIND_DIRECTION ),
42
- Quantities . getQuantity( 1.66103506088257d , StandardUnits . WIND_VELOCITY )))
37
+ time, new WeatherValue ( coordinate,
38
+ data . getQuantityOptional( " directIrradiance " , StandardUnits . SOLAR_IRRADIANCE ) . orElse( null ),
39
+ data . getQuantityOptional( " diffuseIrradiance " , StandardUnits . SOLAR_IRRADIANCE ) . orElse( null ),
40
+ data . getQuantityOptional( " temperature " , StandardUnits . TEMPERATURE ) . orElse( null ) ,
41
+ data . getQuantityOptional( " windDirection " , StandardUnits . WIND_DIRECTION ) . orElse( null ),
42
+ data . getQuantityOptional( " windVelocity " , StandardUnits . WIND_VELOCITY ) . orElse( null )))
43
43
44
44
when :
45
45
def model = factory. buildModel(data)
@@ -67,12 +67,16 @@ class CosmoTimeBasedWeatherValueFactoryTest extends Specification {
67
67
def data = new TimeBasedWeatherValueData (parameter, coordinate)
68
68
69
69
def expectedResults = new TimeBasedValue (
70
- time, new WeatherValue (coordinate,
71
- Quantities . getQuantity(286.872985839844d , StandardUnits . SOLAR_IRRADIANCE ),
72
- Quantities . getQuantity(282.671997070312d , StandardUnits . SOLAR_IRRADIANCE ),
73
- Quantities . getQuantity(278.019012451172d , StandardUnits . TEMPERATURE ),
74
- Quantities . getQuantity(0d , StandardUnits . WIND_DIRECTION ),
75
- Quantities . getQuantity(1.66103506088257d , StandardUnits . WIND_VELOCITY )))
70
+ time, new WeatherValue (
71
+ coordinate,
72
+ data. getQuantityOptional(" directIrradiance" , StandardUnits . SOLAR_IRRADIANCE ). orElse(null ),
73
+ data. getQuantityOptional(" diffuseIrradiance" , StandardUnits . SOLAR_IRRADIANCE ). orElse(null ),
74
+ data. getQuantityOptional(" temperature" , StandardUnits . TEMPERATURE ). orElse(null ),
75
+ data. getQuantityOptional(" windDirection" , StandardUnits . WIND_DIRECTION ). orElse(null ),
76
+ data. getQuantityOptional(" windVelocity" , StandardUnits . WIND_VELOCITY ). orElse(null )
77
+ )
78
+ )
79
+
76
80
77
81
when :
78
82
def model = factory. buildModel(data)
0 commit comments