Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
4.08 Adding weather with location to the uribuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyla committed Mar 4, 2015
1 parent 44facd1 commit 37e439c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.example.android.sunshine.app.data;

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

/*
Expand All @@ -30,15 +31,15 @@ public class TestWeatherContract extends AndroidTestCase {
/*
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");
// }
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");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ public static Uri buildWeatherUri(long id) {
}

/*
Student: Fill in this buildWeatherLocation function
Student: This is the buildWeatherLocation function you filled in.
*/
public static Uri buildWeatherLocation(String locationSetting) {
return null;
return CONTENT_URI.buildUpon().appendPath(locationSetting).build();
}

public static Uri buildWeatherLocationWithStartDate(
Expand Down

0 comments on commit 37e439c

Please sign in to comment.