### Question:
PathInfoUtil { public static String getSuffixSegment(final SlingHttpServletRequest request, int index) { final String[] suffixes = getSuffixSegments(request); if (index >= 0 && index < suffixes.length) { return suffixes[index]; } else { return null; } } private  PathInfoUtil(); static String getQueryParam(final SlingHttpServletRequest request, final String key); static String getQueryParam(final SlingHttpServletRequest request, final String key, final String dfault); static String getSelector(final SlingHttpServletRequest request, final int index); static String getSelector(final SlingHttpServletRequest request,
                                     final int index, final String defaultValue); static String[] getSuffixSegments(final SlingHttpServletRequest request); static String getSuffixSegment(final SlingHttpServletRequest request, int index); static String getSuffix(final SlingHttpServletRequest request); static String getFirstSuffixSegment(final SlingHttpServletRequest request); static String getLastSuffixSegment(final SlingHttpServletRequest request);  }### Answer:
@Test public void testGetSuffixSegment() { ResourceResolver resourceResolver = context.resourceResolver(); MockSlingHttpServletRequest request = context.request(); request.setResource(resourceResolver.getResource("/apple/macbookair")); MockRequestPathInfo requestPathInfo = (MockRequestPathInfo)request.getRequestPathInfo(); requestPathInfo.setSelectorString("show.test"); requestPathInfo.setExtension("html"); requestPathInfo.setSuffix("super/simple"); request.setQueryString("cpu=i7&ghz=2.4"); String expResult = "super"; String result = PathInfoUtil.getSuffixSegment(request, 0); assertEquals(expResult, result); expResult = "simple"; result = PathInfoUtil.getSuffixSegment(request, 1); assertEquals(expResult, result); result = PathInfoUtil.getSuffixSegment(request, -1); assertNull(result); result = PathInfoUtil.getSuffixSegment(request, 10); assertNull(result); }