@@ -0,0 +1,1593 @@
+package com.github.davidcarboni.restolino.helpers;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.util.List;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class PathTest %7B%0A%0A%09@Mock%0A%09HttpServletRequest request;%0A%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%7D%0A%0A%09@Test%0A%09public void shouldGeFirstSegment() %7B%0A%0A%09%09// Given%0A%09%09when(request.getPathInfo()).thenReturn(%22/first/second/third%22);%0A%0A%09%09// When%0A%09%09Path path = new Path(request);%0A%0A%09%09// Then%0A%09%09assertEquals(%22first%22, path.firstSegment());%0A%09%7D%0A%0A%09@Test%0A%09public void shouldGeLastSegment() %7B%0A%0A%09%09// Given%0A%09%09when(request.getPathInfo()).thenReturn(%22/first/second/third%22);%0A%0A%09%09// When%0A%09%09Path path = new Path(request);%0A%0A%09%09// Then%0A%09%09assertEquals(%22third%22, path.lastSegment());%0A%09%7D%0A%0A%09@Test%0A%09public void shouldGeSegments() %7B%0A%0A%09%09// Given%0A%09%09when(request.getPathInfo()).thenReturn(%22/first/second/third%22);%0A%0A%09%09// When%0A%09%09Path path = new Path(request);%0A%09%09List%3CString%3E segments = path.segments();%0A%0A%09%09// Then%0A%09%09assertEquals(3, segments.size());%0A%09%09assertEquals(%22first%22, segments.get(0));%0A%09%09assertEquals(%22second%22, segments.get(1));%0A%09%09assertEquals(%22third%22, segments.get(2));%0A%09%7D%0A%0A%09@Test%0A%09public void shouldHandleEmptyPath() %7B%0A%0A%09%09// Given%0A%09%09when(request.getPathInfo()).thenReturn(%22/%22);%0A%0A%09%09// When%0A%09%09Path path = new Path(request);%0A%09%09List%3CString%3E segments = path.segments();%0A%0A%09%09// Then%0A%09%09assertEquals(0, segments.size());%0A%09%7D%0A%0A%7D%0A

Test for the Path class.