### Question:
SmsRealmProvider implements RequestHandler { protected String getExpectedPathFromRequestContext(UpdateRequest request) throws org.forgerock.oauth2.core.exceptions.NotFoundException { String contextPath = request.getContent().get(PATH_ATTRIBUTE_NAME).asString(); String realmName = request.getContent().get(REALM_NAME_ATTRIBUTE_NAME).asString(); if (contextPath.endsWith("/")) { contextPath = contextPath.substring(0, contextPath.lastIndexOf('/')); } if (!realmName.startsWith("/")) { realmName = "/" + realmName; } return realmNormaliser.normalise(contextPath + realmName); } SmsRealmProvider(SessionCache sessionCache,
                            CoreWrapper coreWrapper,
                            RealmNormaliser realmNormaliser); @Override Promise<ActionResponse, ResourceException> handleAction(Context context, ActionRequest request); @Override Promise<ResourceResponse, ResourceException> handleCreate(Context serverContext,
            CreateRequest createRequest); @Override Promise<ResourceResponse, ResourceException> handleDelete(Context serverContext,
            DeleteRequest request); @Override Promise<ResourceResponse, ResourceException> handlePatch(Context context, PatchRequest request); @Override Promise<QueryResponse, ResourceException> handleQuery(Context context, QueryRequest request,
            QueryResourceHandler handler); @Override Promise<ResourceResponse, ResourceException> handleRead(Context context, ReadRequest request); @Override Promise<ResourceResponse, ResourceException> handleUpdate(Context context, UpdateRequest request);  }### Answer:
@Test public void testGetExpectedPathFromRequestContext() throws NotFoundException { doExpectedPathCheck("path/", "realmName", "path/realmName"); doExpectedPathCheck("path/", "/realmName", "path/realmName"); doExpectedPathCheck("path", "/realmName", "path/realmName"); doExpectedPathCheck("path", "realmName", "path/realmName"); doExpectedPathCheck("/path", "realmName/", "/path/realmName/"); doExpectedPathCheck("/path", "/", "/path/"); doExpectedPathCheck("/path/", "/", "/path/"); doExpectedPathCheck("/path/", "", "/path/"); doExpectedPathCheck("/path", "", "/path/"); doExpectedPathCheck("/path", "parentName/ChildName", "/path/parentName/ChildName"); doExpectedPathCheck("path", "/parentName/ChildName", "path/parentName/ChildName"); doExpectedPathCheck("path/", "parentName/ChildName", "path/parentName/ChildName"); doExpectedPathCheck("path/", "/parentName/ChildName", "path/parentName/ChildName"); }