Android Open Source - umbrella.alert Forecast Test






From Project

Back to project page umbrella.alert.

License

The source code is released under:

GNU General Public License

If you think the Android project umbrella.alert listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package macbury.umbrella;
//from w w  w .j  ava 2 s .com
import android.test.ApplicationTestCase;

import junit.framework.TestCase;

import macbury.umbrella.factories.WeatherForecastFactory;
import macbury.umbrella.model.Forecast;

/**
 * Created by macbury on 27.08.14.
 */
public class ForecastTest extends TestCase {

  public void testItShouldHaveParsedRainDataWithDate() {
    Forecast forecast = new Forecast();
    forecast.parse(WeatherForecastFactory.rainNext6Hours());

    assertNotNull(forecast.getFromDate());
    assertNotNull(forecast.getToDate());
    assertNotNull(forecast.getCity());
    assertNotSame(forecast.getFromDate(), forecast.getToDate());
    assertEquals(true, forecast.getFromDate().before(forecast.getToDate()));
  }

  public void testItShouldTakeUmbrellaIfThereIsAnyChanceOfRainInNext6Hrs() {
    Forecast forecast = new Forecast();
    forecast.parse(WeatherForecastFactory.rainNext6Hours());
    assertTrue(forecast.takeUmbrella());
  }

  public void testItShouldNotTakeUmbrellaIfThereIsNoChanceOfRainInNext6Hrs() {
    Forecast forecast = new Forecast();
    forecast.parse(WeatherForecastFactory.notRainNext6Hours());
    assertEquals(0, forecast.getTotalRainVolume());
    assertFalse(forecast.takeUmbrella());
  }
}




Java Source Code List

macbury.umbrella.ApplicationTest.java
macbury.umbrella.ForecastTest.java
macbury.umbrella.UmbrellaApplication.java
macbury.umbrella.activity.ForecastActivity.java
macbury.umbrella.activity.SettingsActivity.java
macbury.umbrella.cards.AboutCard.java
macbury.umbrella.cards.CityCard.java
macbury.umbrella.cards.PrecipitationCard.java
macbury.umbrella.factories.WeatherForecastFactory.java
macbury.umbrella.fragments.ForecastFragment.java
macbury.umbrella.fragments.LoadingFragment.java
macbury.umbrella.fragments.SettingsFragment.java
macbury.umbrella.managers.AlarmsManager.java
macbury.umbrella.managers.IntentsManager.java
macbury.umbrella.managers.NotificationsManager.java
macbury.umbrella.managers.ServicesManager.java
macbury.umbrella.managers.StoreManager.java
macbury.umbrella.model.Forecast.java
macbury.umbrella.model.RainData.java
macbury.umbrella.providers.ForecastProviderError.java
macbury.umbrella.providers.ForecastProviderListener.java
macbury.umbrella.providers.ForecastProvider.java
macbury.umbrella.receiver.CheckWeatherReceiver.java
macbury.umbrella.receiver.DissmisedTakeUmbrellaNotificationReceiver.java
macbury.umbrella.receiver.SyncStatusBroadcastReceiver.java
macbury.umbrella.service.CheckWeatherService.java