Uriクラスのテストクラス
Uriクラスのメソッドで毎回混乱するから、テストメソッドを書いた。
public void testUri() { Uri uri = Uri.parse("content://anony@com.limelabo:77777/person/1?history=10#name"); assertEquals("//anony@com.limelabo:77777/person/1?history=10", uri.getSchemeSpecificPart()); assertEquals("anony@com.limelabo:77777", uri.getAuthority()); assertEquals("content", uri.getScheme()); assertEquals("anony", uri.getUserInfo()); assertEquals("com.limelabo", uri.getHost()); assertEquals(77777, uri.getPort()); assertEquals("/person/1", uri.getPath()); assertEquals("1", uri.getLastPathSegment()); assertEquals("history=10", uri.getQuery()); assertEquals("name", uri.getFragment()); assertEquals(2, uri.getPathSegments().size()); assertEquals("person", uri.getPathSegments().get(0)); assertEquals("1", uri.getPathSegments().get(1)); assertEquals("10", uri.getQueryParameter("history")); assertEquals(1, uri.getQueryParameters("history").size()); assertEquals("10", uri.getQueryParameters("history").get(0)); }