@Test public void testToPlaceRequestStaticVsParameterMatch() {

    // When
    PlaceRequest placeRequest01 = tokenFormatter.toPlaceRequest("/user/0x42/albums/0xAFFE");
    PlaceRequest placeRequest02 = tokenFormatter.toPlaceRequest("/user/staticUserId/albums/staticAlbumId");
    PlaceRequest placeRequest03 = tokenFormatter.toPlaceRequest("/user/0x42/albums/staticAlbumId");
    PlaceRequest placeRequest04 = tokenFormatter.toPlaceRequest("/user/staticUserId/albums/0xAFFE");
    PlaceRequest placeRequest05 = tokenFormatter.toPlaceRequest("/privacy");
    PlaceRequest placeRequest06 = tokenFormatter.toPlaceRequest("/vanity");
    PlaceRequest placeRequest07 = tokenFormatter.toPlaceRequest("/user/0x42/albums/0xAFFE?start=0");
    PlaceRequest placeRequest08 = tokenFormatter.toPlaceRequest("/vanity?a=valueA&b=valueB");
    PlaceRequest placeRequest09 = tokenFormatter.toPlaceRequest("vanity?a=valueA&b=valueB");
    PlaceRequest placeRequest10 = tokenFormatter.toPlaceRequest("!/crawl/vanity");
    PlaceRequest placeRequest11 = tokenFormatter.toPlaceRequest("!/crawl/vanity?a=valueA&b=valueB");
    // Then
    assertEquals("/user/{userId}/albums/{albumId}", placeRequest01.getNameToken());
    assertEquals(2, placeRequest01.getParameterNames().size());
    assertEquals("0x42", placeRequest01.getParameter("userId", null));
    assertEquals("0xAFFE", placeRequest01.getParameter("albumId", null));
    assertEquals("/user/staticUserId/albums/staticAlbumId", placeRequest02.getNameToken());
    assertEquals(0, placeRequest02.getParameterNames().size());
    assertEquals("/user/{userId}/albums/staticAlbumId", placeRequest03.getNameToken());
    assertEquals(1, placeRequest03.getParameterNames().size());
    assertEquals("0x42", placeRequest03.getParameter("userId", null));
    assertEquals("/user/staticUserId/albums/{albumId}", placeRequest04.getNameToken());
    assertEquals(1, placeRequest04.getParameterNames().size());
    assertEquals("0xAFFE", placeRequest04.getParameter("albumId", null));
    assertEquals("/privacy", placeRequest05.getNameToken());
    assertEquals(0, placeRequest05.getParameterNames().size());
    assertEquals("/{vanityId}", placeRequest06.getNameToken());
    assertEquals(1, placeRequest06.getParameterNames().size());
    assertEquals("vanity", placeRequest06.getParameter("vanityId", null));
    assertEquals("/user/{userId}/albums/{albumId}", placeRequest07.getNameToken());
    assertEquals(3, placeRequest07.getParameterNames().size());
    assertEquals("0x42", placeRequest07.getParameter("userId", null));
    assertEquals("0xAFFE", placeRequest07.getParameter("albumId", null));
    assertEquals("0", placeRequest07.getParameter("start", null));
    assertEquals("/{vanityId}", placeRequest08.getNameToken());
    assertEquals(3, placeRequest08.getParameterNames().size());
    assertEquals("vanity", placeRequest08.getParameter("vanityId", null));
    assertEquals("valueA", placeRequest08.getParameter("a", null));
    assertEquals("valueB", placeRequest08.getParameter("b", null));
    assertEquals("/{vanityId}", placeRequest09.getNameToken());
    assertEquals(3, placeRequest09.getParameterNames().size());
    assertEquals("vanity", placeRequest09.getParameter("vanityId", null));
    assertEquals("valueA", placeRequest09.getParameter("a", null));
    assertEquals("valueB", placeRequest09.getParameter("b", null));
    assertEquals("!/crawl/{vanityId}", placeRequest10.getNameToken());
    assertEquals(1, placeRequest10.getParameterNames().size());
    assertEquals("vanity", placeRequest10.getParameter("vanityId", null));
    assertEquals("!/crawl/{vanityId}", placeRequest11.getNameToken());
    assertEquals(3, placeRequest11.getParameterNames().size());
    assertEquals("vanity", placeRequest10.getParameter("vanityId", null));
    assertEquals("valueA", placeRequest11.getParameter("a", null));
    assertEquals("valueB", placeRequest11.getParameter("b", null));
}