Skip to content

Instantly share code, notes, and snippets.

@cnevinc
Created November 1, 2015 12:09
Show Gist options
  • Save cnevinc/06f720f31823632fbf5d to your computer and use it in GitHub Desktop.
Save cnevinc/06f720f31823632fbf5d to your computer and use it in GitHub Desktop.
Config test using Kotlin
package com.biideal.biibonus.ui
import com.biideal.biibonus.util.Config
import junit.framework.Assert
import org.junit.Test
/**
* Test the util implementation
*/
public class ConfigTest {
@Test fun testDeepLink() {
var url = "biibonus://coupon/12?store_id=2&sotre_id=3"
var result = Config.parseDeepLink(url)
Assert.assertEquals("coupon", result["feature"])
Assert.assertEquals("2", result["store_id"])
Assert.assertEquals("/12", result["path"])
url = "Biibonus2://coupon/12?store_id=2"
result = Config.parseDeepLink(url)
Assert.assertEquals("coupon", result["feature"])
Assert.assertEquals("2", result["store_id"])
Assert.assertEquals("/12", result["path"])
url = "Biibonus2://coupon/12?store_id=2&coupon_id=3"
result = Config.parseDeepLink(url)
Assert.assertEquals("coupon", result["feature"])
Assert.assertEquals("2", result["store_id"])
Assert.assertEquals("3", result["coupon_id"])
Assert.assertEquals("/12", result["path"])
url = "biibonus://coupon/id/12?store_id=2&sotre_id=3&store_id=2"
result = Config.parseDeepLink(url)
Assert.assertEquals("coupon", result["feature"])
Assert.assertEquals("2", result["store_id"])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment