package org.roklib.urifragmentrouting.mapper;

import org.junit.Before;
import org.junit.Test;
import org.roklib.urifragmentrouting.parameter.ParameterMode;
import org.roklib.urifragmentrouting.parameter.SingleLongUriParameter;
import org.roklib.urifragmentrouting.parameter.value.CapturedParameterValues;

import java.util.Collections;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class CatchAllUriPathSegmentActionMapperTest {

    private CatchAllUriPathSegmentActionMapper<Long> mapper;

    @Before
    public void setUp() {
        mapper = new CatchAllUriPathSegmentActionMapper<>("mapperName", new SingleLongUriParameter("value"));
    }

    @Test
    public void test() {
        CapturedParameterValues capturedParameterValues = new CapturedParameterValues();
        mapper.interpretTokensImpl(capturedParameterValues,
                "123",
                Collections.emptyList(),
                Collections.emptyMap(),
                ParameterMode.DIRECTORY);

        assertThat(capturedParameterValues.hasValueFor("mapperName", "value"), is(true));
        assertThat(capturedParameterValues.getValueFor("mapperName", "value").getValue(), is(123L));
    }
}

@@ -543,16 +543,17 @@
 @Before%0A
+%0A
     publ
@@ -730,16 +730,22 @@
         
+final 
 Captured
@@ -1110,24 +1110,24 @@
  is(true));%0A
-
         asse
@@ -1220,11 +1220,308 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void action_mapper_is_responsible_for_all_tokens() throws Exception %7B%0A        assertThat(mapper.isResponsibleForToken(%22%22), is(true));%0A        assertThat(mapper.isResponsibleForToken(%22token%22), is(true));%0A        assertThat(mapper.isResponsibleForToken(null), is(true));%0A    %7D
 %0A%7D%0A

Add unit test