### Question:
UmaSharingService { public Share findShare(Request request) throws UmaException { Share matching = null; String path = request.getUri().getPath(); int longest = -1; for (Share share : shares.values()) { Matcher matcher = share.getPattern().matcher(path); if (matcher.matches()) { if (matcher.end() > longest) { matching = share; longest = matcher.end(); } } } if (matching == null) { throw new UmaException(format("Can't find any shared resource for %s", path)); } return matching; } UmaSharingService(final Handler protectionApiHandler,
                             final List<ShareTemplate> templates,
                             final URI authorizationServer,
                             final String clientId,
                             final String clientSecret); Promise<Share, UmaException> createShare(final Context context,
                                                    final String resourcePath,
                                                    final String pat); Share findShare(Request request); Share removeShare(String shareId); Set<Share> listShares(); URI getAuthorizationServer(); URI getTicketEndpoint(); URI getIntrospectionEndpoint(); Share getShare(final String id); String getClientId(); String getClientSecret();  }### Answer:
@Test(dependsOnMethods = "shouldCreateShare") public void shouldFindShare() throws Exception { Request request = new Request(); request.setUri("http: Share share = service.findShare(request); assertThat(share).isNotNull(); }
@Test(dependsOnMethods = "shouldCreateShare", expectedExceptions = UmaException.class) public void shouldNotFindShare() throws Exception { Request request = new Request(); request.setUri("http: service.findShare(request); }