Android Open Source - Android_Sunshine_Udacity Test Weather Contract






From Project

Back to project page Android_Sunshine_Udacity.

License

The source code is released under:

MIT License

If you think the Android project Android_Sunshine_Udacity 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

/*
 * Copyright (C) 2014 The Android Open Source Project
 */*  www  .  j a  v a2  s  . c  o m*/
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.example.talonso.sunshine.data;

        import android.net.Uri;
        import android.test.AndroidTestCase;

/*
    Students: This is NOT a complete test for the WeatherContract --- just for the functions
    that we expect you to write.
 */
public class TestWeatherContract extends AndroidTestCase {

    // intentionally includes a slash to make sure Uri is getting quoted correctly
    private static final String TEST_WEATHER_LOCATION = "/North Pole";
    private static final long TEST_WEATHER_DATE = 1419033600L;  // December 20th, 2014

    /*
        Students: Uncomment this out to test your weather location function.
     */
    public void testBuildWeatherLocation() {
        Uri locationUri = WeatherContract.WeatherEntry.buildWeatherLocation(TEST_WEATHER_LOCATION);
        assertNotNull("Error: Null Uri returned.  You must fill-in buildWeatherLocation in " +
                        "WeatherContract.",
                locationUri);
        assertEquals("Error: Weather location not properly appended to the end of the Uri",
                TEST_WEATHER_LOCATION, locationUri.getLastPathSegment());
        assertEquals("Error: Weather location Uri doesn't match our expected result",
                locationUri.toString(),
                "content://com.example.android.sunshine.app/weather/%2FNorth%20Pole");
    }
}




Java Source Code List

com.example.talonso.sunshine.DetailActivity.java
com.example.talonso.sunshine.DetailFragment.java
com.example.talonso.sunshine.ForecastAdapter.java
com.example.talonso.sunshine.ForecastFragment.java
com.example.talonso.sunshine.FullTestSuite.java
com.example.talonso.sunshine.MainActivity.java
com.example.talonso.sunshine.SettingsActivity.java
com.example.talonso.sunshine.Utility.java
com.example.talonso.sunshine.data.TestDb.java
com.example.talonso.sunshine.data.TestProvider.java
com.example.talonso.sunshine.data.TestUriMatcher.java
com.example.talonso.sunshine.data.TestUtilities.java
com.example.talonso.sunshine.data.TestWeatherContract.java
com.example.talonso.sunshine.data.WeatherContract.java
com.example.talonso.sunshine.data.WeatherDbHelper.java
com.example.talonso.sunshine.data.WeatherProvider.java
com.example.talonso.sunshine.sync.SunshineAuthenticatorService.java
com.example.talonso.sunshine.sync.SunshineAuthenticator.java
com.example.talonso.sunshine.sync.SunshineSyncAdapter.java
com.example.talonso.sunshine.utils.PollingCheck.java