@@ -0,0 +1,3029 @@
+/*%0A * Copyright (C) 2014 The Android Open Source Project%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.example.android.sunshine.app.data;%0A%0Aimport android.net.Uri;%0Aimport android.test.AndroidTestCase;%0A%0A/*%0A    Uncomment this class when you are ready to test your UriMatcher.  Note that this class utilizes%0A    constants that are declared with package protection inside of the UriMatcher, which is why%0A    the test must be in the same data package as the Android app code.  Doing the test this way is%0A    a nice compromise between data hiding and testability.%0A */%0Apublic class TestUriMatcher extends AndroidTestCase %7B%0A    private static final String LOCATION_QUERY = %22London, UK%22;%0A    private static final long TEST_DATE = 1419033600L;  // December 20th, 2014%0A    private static final long TEST_LOCATION_ID = 10L;%0A%0A    // content://com.example.android.sunshine.app/weather%22%0A    private static final Uri TEST_WEATHER_DIR = WeatherContract.WeatherEntry.CONTENT_URI;%0A    private static final Uri TEST_WEATHER_WITH_LOCATION_DIR = WeatherContract.WeatherEntry.buildWeatherLocation(LOCATION_QUERY);%0A    private static final Uri TEST_WEATHER_WITH_LOCATION_AND_DATE_DIR = WeatherContract.WeatherEntry.buildWeatherLocationWithDate(LOCATION_QUERY, TEST_DATE);%0A    // content://com.example.android.sunshine.app/location%22%0A    private static final Uri TEST_LOCATION_DIR = WeatherContract.LocationEntry.CONTENT_URI;%0A%0A    /*%0A        Students: This function tests that your UriMatcher returns the correct integer value%0A        for each of the Uri types that our ContentProvider can handle.  Uncomment this when you are%0A        ready to test your UriMatcher.%0A     */%0A//    public void testUriMatcher() %7B%0A//        UriMatcher testMatcher = WeatherProvider.buildUriMatcher();%0A//%0A//        assertEquals(%22Error: The WEATHER URI was matched incorrectly.%22,%0A//                testMatcher.match(TEST_WEATHER_DIR), WeatherProvider.WEATHER);%0A//        assertEquals(%22Error: The WEATHER WITH LOCATION URI was matched incorrectly.%22,%0A//                testMatcher.match(TEST_WEATHER_WITH_LOCATION_DIR), WeatherProvider.WEATHER_WITH_LOCATION);%0A//        assertEquals(%22Error: The WEATHER WITH LOCATION AND DATE URI was matched incorrectly.%22,%0A//                testMatcher.match(TEST_WEATHER_WITH_LOCATION_AND_DATE_DIR), WeatherProvider.WEATHER_WITH_LOCATION_AND_DATE);%0A//        assertEquals(%22Error: The LOCATION URI was matched incorrectly.%22,%0A//                testMatcher.match(TEST_LOCATION_DIR), WeatherProvider.LOCATION);%0A//    %7D%0A%7D

Create TestUriMatcher