Home | History | Annotate | Download | only in shadows
      1 package com.xtremelabs.robolectric.shadows;
      2 
      3 import android.net.Uri;
      4 import com.xtremelabs.robolectric.WithTestDefaultsRunner;
      5 import org.junit.Test;
      6 import org.junit.runner.RunWith;
      7 
      8 import static org.hamcrest.CoreMatchers.equalTo;
      9 import static org.hamcrest.MatcherAssert.assertThat;
     10 
     11 @RunWith(WithTestDefaultsRunner.class)
     12 public class UriTest {
     13     @Test
     14     public void shouldParseUris() throws Exception {
     15         Uri testUri = Uri.parse("http://someplace.com:8080/a/path?param=value&another_param=another_value#top");
     16 
     17         assertThat(testUri.getQuery(), equalTo("param=value&another_param=another_value"));
     18         assertThat(testUri.getPort(), equalTo(8080));
     19         assertThat(testUri.getAuthority(), equalTo("someplace.com:8080"));
     20         assertThat(testUri.getHost(), equalTo("someplace.com"));
     21         assertThat(testUri.getFragment(), equalTo("top"));
     22         assertThat(testUri.getPath(), equalTo("/a/path"));
     23         assertThat(testUri.getScheme(), equalTo("http"));
     24     }
     25 }
     26