### Question:
ServiceTypeDiscoveryService { public ServiceType getServiceType() { return ServiceTypeDiscovery.getServiceType(new UrlPathHelper().getPathWithinApplication(request)); }  ServiceType getServiceType();  }### Answer:
@Test void getServiceType() { request = new MockHttpServletRequest("GET", "/v1/consents"); cut = new ServiceTypeDiscoveryService(request); ServiceType result = cut.getServiceType(); assertEquals("AIS", result.name()); }
@Test void getServiceTypeWithContextPath() { request = new MockHttpServletRequest("GET", "/xs2a/v1/consents"); request.setContextPath("/xs2a"); cut = new ServiceTypeDiscoveryService(request); ServiceType result = cut.getServiceType(); assertEquals("AIS", result.name()); }