@Test
public void shouldObeyPriorityOfRoutes() throws Exception {
Route first = mock(Route.class);
Route second = mock(Route.class);
ResourceMethod method2 = second.resourceMethod(request, "second");
router.add(second);
router.add(first);
when(first.getPriority()).thenReturn(Path.HIGH);
when(second.getPriority()).thenReturn(Path.LOW);
EnumSet<HttpMethod> get = EnumSet.of(HttpMethod.GET);
when(first.allowedMethods()).thenReturn(get);
when(second.allowedMethods()).thenReturn(get);
when(first.canHandle(anyString())).thenReturn(false);
when(second.canHandle(anyString())).thenReturn(true);
ResourceMethod found = router.parse("anything", HttpMethod.GET, request);
assertThat(found, is(method2));
}