### Question:
MtasApiAuthorizationFilter extends SpaceGuidBasedAuthorizationFilter { @Override protected String extractSpaceGuid(HttpServletRequest request) { String uri = ServletUtil.decodeUri(request); return extractSpaceGuid(ServletUtil.removeInvalidForwardSlashes(uri)); } @Inject  MtasApiAuthorizationFilter(AuthorizationChecker authorizationChecker); @Override String getUriRegex();  }### Answer:
@Test void testExtractSpaceGuid() { Mockito.when(request.getRequestURI()) .thenReturn(String.format("/api/v1/spaces/%s/mtas", SPACE_GUID)); assertEquals(SPACE_GUID, mtasApiAuthorizationFilter.extractSpaceGuid(request)); }
@Test void testExtractSpaceGuidWithDoubleForwardSlashes() { Mockito.when(request.getRequestURI()) .thenReturn(String.format("/api assertEquals(SPACE_GUID, mtasApiAuthorizationFilter.extractSpaceGuid(request)); }
@Test void testExtractSpaceGuidWithNonMatchingUri() { Mockito.when(request.getRequestURI()) .thenReturn("/public/ping"); assertThrows(SLException.class, () -> mtasApiAuthorizationFilter.extractSpaceGuid(request)); }