1414 */
1515public class UriHelperTest extends AndroidTestCase {
1616
17- private static final String GOOGLE_PLAY = "https://play.google.com/store/apps/details?id=" ;
17+ private static final String CHINESE_STORES = "market://details?id=" ;
18+
19+ private static final String GOOGLE_PLAY = "market://details?id=" ;
20+
21+ private static final String GOOGLE_PLAY_WEB = "https://play.google.com/store/apps/details?id=" ;
22+
23+ @ SuppressWarnings ("ConstantConditions" )
24+ public void testGetChineseStoresUri () {
25+ {
26+ Uri uri = UriHelper .getStoreUri (StoreType .CHINESESTORES ,"" );
27+ assertEquals (uri .toString (), CHINESE_STORES );
28+ }
29+ {
30+ Uri uri = UriHelper .getStoreWebUri (StoreType .CHINESESTORES ,"" );
31+ assertNull (uri );
32+ }
33+ {
34+ Uri uri = UriHelper .getStoreUri (StoreType .CHINESESTORES ,null );
35+ assertNull (uri );
36+ }
37+ {
38+ Uri uri = UriHelper .getStoreWebUri (StoreType .CHINESESTORES ,null );
39+ assertNull (uri );
40+ }
41+ {
42+ final String paramName = "com.vorlonsoft.android.rate" ;
43+ Uri uri = UriHelper .getStoreUri (StoreType .CHINESESTORES , paramName );
44+ assertEquals (uri .toString (), CHINESE_STORES + paramName );
45+ }
46+ {
47+ final String paramName = "com.vorlonsoft.android.rate" ;
48+ Uri uri = UriHelper .getStoreWebUri (StoreType .CHINESESTORES , paramName );
49+ assertNull (uri );
50+ }
51+ }
1852
1953 @ SuppressWarnings ("ConstantConditions" )
2054 public void testGetGooglePlayUri () {
2155 {
22- Uri uri = UriHelper .getGooglePlay ( "" );
56+ Uri uri = UriHelper .getStoreUri ( StoreType . GOOGLEPLAY , "" );
2357 assertEquals (uri .toString (), GOOGLE_PLAY );
2458 }
2559 {
26- Uri uri = UriHelper .getGooglePlay (null );
60+ Uri uri = UriHelper .getStoreWebUri (StoreType .GOOGLEPLAY ,"" );
61+ assertEquals (uri .toString (), GOOGLE_PLAY_WEB );
62+ }
63+ {
64+ Uri uri = UriHelper .getStoreUri (StoreType .GOOGLEPLAY ,null );
2765 assertNull (uri );
2866 }
2967 {
30- final String packageName = "com.vorlonsoft.android.rate" ;
31- Uri uri = UriHelper .getGooglePlay (packageName );
32- assertEquals (uri .toString (), GOOGLE_PLAY + packageName );
68+ Uri uri = UriHelper .getStoreWebUri (StoreType .GOOGLEPLAY ,null );
69+ assertNull (uri );
70+ }
71+ {
72+ final String paramName = "com.vorlonsoft.android.rate" ;
73+ Uri uri = UriHelper .getStoreUri (StoreType .GOOGLEPLAY , paramName );
74+ assertEquals (uri .toString (), GOOGLE_PLAY + paramName );
75+ }
76+ {
77+ final String paramName = "com.vorlonsoft.android.rate" ;
78+ Uri uri = UriHelper .getStoreWebUri (StoreType .GOOGLEPLAY , paramName );
79+ assertEquals (uri .toString (), GOOGLE_PLAY_WEB + paramName );
3380 }
3481 }
3582}
0 commit comments