### Question:
ScriptResource extends RealmAwareResource { @Override public Promise<ResourceResponse, ResourceException> readInstance(Context context, String resourceId, ReadRequest request) { try { return newResultPromise(newResourceResponse(resourceId, null, asJson( serviceFactory.create(getContextSubject(context), getRealm(context)).get(resourceId)))); } catch (ScriptException se) { return exceptionMappingHandler.handleError(context, request, se).asPromise(); } } @Inject  ScriptResource(@Named("ScriptLogger") Logger logger,
                          ScriptingServiceFactory scriptConfigService,
                          ExceptionMappingHandler<ScriptException, ResourceException> exceptionMappingHandler,
                          ScriptValidator scriptValidator); @Override Promise<ActionResponse, ResourceException> actionCollection(Context context, ActionRequest request); @Override Promise<ActionResponse, ResourceException> actionInstance(Context context, String resourceId,
            ActionRequest request); @Override Promise<ResourceResponse, ResourceException> patchInstance(Context context, String resourceId,
            PatchRequest request); @Override Promise<ResourceResponse, ResourceException> createInstance(Context context, CreateRequest request); @Override Promise<ResourceResponse, ResourceException> deleteInstance(Context context, String resourceId,
            DeleteRequest request); @Override Promise<QueryResponse, ResourceException> queryCollection(Context context, QueryRequest request,
            QueryResourceHandler resultHandler); @Override Promise<ResourceResponse, ResourceException> readInstance(Context context, String resourceId,
            ReadRequest request); @Override Promise<ResourceResponse, ResourceException> updateInstance(Context context, String resourceId,
            UpdateRequest request);  }### Answer:
@Test public void shouldReadScriptConfigurationWithoutError() throws Exception { String resourceId = "1234567890"; scriptConfigSet.clear(); scriptConfigSet.put(resourceId, ScriptConfiguration.builder() .setId(resourceId) .setName("MyJavaScript") .setDescription("A test JavaScript configuration") .setScript(script) .setLanguage(JAVASCRIPT) .setContext(POLICY_CONDITION).build()); ReadRequest readRequest = mock(ReadRequest.class); Promise<ResourceResponse, ResourceException> promise = scriptResource.readInstance(context, resourceId, readRequest); ResourceResponse response = promise.getOrThrowUninterruptibly(); assertNotNull(response); assertNotNull(response.getId()); assertEquals(response.getId(), resourceId); JsonValue responseJson = response.getContent(); assertEquals(responseJson.get(JSON_UUID).asString(), resourceId); assertEquals(responseJson.get(SCRIPT_NAME).asString(), "MyJavaScript"); assertEquals(responseJson.get(SCRIPT_DESCRIPTION).asString(), "A test JavaScript configuration"); assertEquals(responseJson.get(SCRIPT_TEXT).asString(), encodeScript); assertEquals(getLanguageFromString(responseJson.get(SCRIPT_LANGUAGE).asString()), JAVASCRIPT); assertEquals(getContextFromString(responseJson.get(SCRIPT_CONTEXT).asString()), POLICY_CONDITION); }