use of com.instructure.interactions.router.Route in project instructure-android by instructure.
the class RouteTest method testRouteNoParams.
// endregion
// region Params
@Test
public void testRouteNoParams() {
HashMap<String, String> expectedParams = new HashMap<>();
Route route = new Route("/courses");
assertTrue(route.apply("http://mobiledev.instructure.com/courses/"));
assertEquals(expectedParams, route.getParamsHash());
// no slash at the end
assertTrue(route.apply("http://mobiledev.instructure.com/courses/"));
assertEquals(expectedParams, route.getParamsHash());
}
use of com.instructure.interactions.router.Route in project instructure-android by instructure.
the class RouteTest method testRouteTwoCharParam.
@Test
public void testRouteTwoCharParam() {
HashMap<String, String> expectedParams = new HashMap<>();
expectedParams.put("course_id", "833052");
expectedParams.put("page_id", "page-3");
Route route = new Route("/courses/:course_id/pages/:page_id");
assertTrue(route.apply("https://mobiledev.instructure.com/courses/833052/pages/page-3/"));
assertEquals(expectedParams, route.getParamsHash());
}
use of com.instructure.interactions.router.Route in project instructure-android by instructure.
the class RouteTest method testRouteThreeIntParams.
@Test
public void testRouteThreeIntParams() {
HashMap<String, String> expectedParams = new HashMap<>();
expectedParams.put("course_id", "953090");
expectedParams.put("assignment_id", "2651861");
expectedParams.put("submission_id", "3690827");
Route route = new Route("/(?:courses|groups)/:course_id/assignments/:assignment_id/submissions/:submission_id");
assertTrue(route.apply("http://mobiledev.instructure.com/courses/953090/assignments/2651861/submissions/3690827/"));
assertEquals(expectedParams, route.getParamsHash());
// no slash at the end
assertTrue(route.apply("http://mobiledev.instructure.com/courses/953090/assignments/2651861/submissions/3690827"));
assertEquals(expectedParams, route.getParamsHash());
}
use of com.instructure.interactions.router.Route in project instructure-android by instructure.
the class RouteTest method testRouteQueryParams.
// endregion
// region Query Params
@Test
public void testRouteQueryParams() {
HashMap<String, String> expectedParams = new HashMap<>();
expectedParams.put("course_id", "836357");
expectedParams.put("quiz_id", "990775");
Route route = new Route("/courses/:course_id/quizzes/:quiz_id");
assertTrue(route.apply("https://mobiledev.instructure.com/courses/836357/quizzes/990775?module_item_id=6723096/"));
assertEquals(expectedParams, route.getParamsHash());
assertEquals("module_item_id=6723096/", route.getQueryString());
// no slash at the end
assertTrue(route.apply("https://mobiledev.instructure.com/courses/836357/quizzes/990775?module_item_id=6723096"));
assertEquals(expectedParams, route.getParamsHash());
assertEquals("module_item_id=6723096", route.getQueryString());
}
use of com.instructure.interactions.router.Route in project instructure-android by instructure.
the class RouteTest method testRouteFragmentIdentifierParams.
// endregion
/*
* Fragment Identifier
*/
@Test
public void testRouteFragmentIdentifierParams() {
HashMap<String, String> expectedParams = new HashMap<>();
expectedParams.put("course_id", "836357");
expectedParams.put("quiz_id", "990775");
Route route = new Route("/courses/:course_id/quizzes/:quiz_id");
assertTrue(route.apply("https://mobiledev.instructure.com/courses/836357/quizzes/990775?module_item_id=6723096#Fragment Identifier"));
assertEquals(expectedParams, route.getParamsHash());
assertEquals("module_item_id=6723096", route.getQueryString());
assertEquals("Fragment Identifier", route.getFragmentIdentifier());
}
Aggregations