@@ -322,4 +322,28 @@ public void defaultsAndSetters() {
322322 public void getCalculatorName () {
323323 assertEquals ("NREL Solar Position Algorithm" , calculator ().getCalculatorName ());
324324 }
325+
326+ /**
327+ * A NaN target zenith (from a NaN / infinite zenith, refraction or solar radius, or a negative / NaN earth radius) used to
328+ * make the bracketing rise / set search run for hours. It must return NaN like the other calculators.
329+ */
330+ @ Test (timeout = 10_000 )
331+ public void nonFiniteZenithReturnsNaNPromptly () {
332+ GeoLocation location = new GeoLocation ("Lakewood, NJ" , 40.0721087 , -74.2400243 , 5017 , ZoneId .of ("America/New_York" ));
333+ LocalDate date = LocalDate .of (2026 , 1 , 1 );
334+ assertTrue (Double .isNaN (calculator ().getUTCSunrise (date , location , Double .POSITIVE_INFINITY , false )));
335+ assertTrue (Double .isNaN (calculator ().getUTCSunset (date , location , Double .NaN , false )));
336+
337+ SPACalculator negativeEarthRadius = calculator ();
338+ negativeEarthRadius .setEarthRadius (-6371 );
339+ assertTrue (Double .isNaN (negativeEarthRadius .getUTCSunrise (date , location , 90.0 , true )));
340+
341+ SPACalculator nanRefraction = calculator ();
342+ nanRefraction .setRefraction (Double .NaN );
343+ assertTrue (Double .isNaN (nanRefraction .getUTCSunset (date , location , 90.0 , false )));
344+
345+ SPACalculator infiniteSolarRadius = calculator ();
346+ infiniteSolarRadius .setSolarRadius (Double .POSITIVE_INFINITY );
347+ assertTrue (Double .isNaN (infiniteSolarRadius .getUTCSunrise (date , location , 90.0 , false )));
348+ }
325349}
0 commit comments