### Question:
PolicyResource implements CollectionResourceProvider { @Override public Promise<ResourceResponse, ResourceException> updateInstance(Context context, String resourceId, UpdateRequest request) { try { Privilege policy = policyParser.parsePolicy(resourceId, request.getContent()); ResourceResponse result = policyResource(policyStoreProvider.getPolicyStore(context).update(resourceId, policy)); return newResultPromise(result); } catch (EntitlementException ex) { DEBUG.error("PolicyResource :: UPDATE : Error updating policy, " + resourceId + ".", ex); return resourceErrorHandler.handleError(context, request, ex).asPromise(); } } @Inject  PolicyResource(final PolicyEvaluatorFactory factory,
                          final PolicyRequestFactory requestFactory,
                          final PolicyParser parser,
                          final PolicyStoreProvider provider,
                          final ExceptionMappingHandler<EntitlementException, ResourceException> handler); @Override Promise<ActionResponse, ResourceException> actionCollection(Context context,
            ActionRequest actionRequest); @Override Promise<ActionResponse, ResourceException> actionInstance(Context context, String resourceId,
            ActionRequest request); @Override Promise<ResourceResponse, ResourceException> createInstance(Context context, CreateRequest request); @Override Promise<ResourceResponse, ResourceException> deleteInstance(Context context, String resourceId,
            DeleteRequest request); @Override Promise<ResourceResponse, ResourceException> patchInstance(Context context, String resourceId,
            PatchRequest request); @Override Promise<QueryResponse, ResourceException> queryCollection(Context context, QueryRequest request,
            QueryResourceHandler handler); @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 shouldUpdatePoliciesInStore() throws Exception { String id = "testPolicy"; long lastModified = 1234l; UpdateRequest request = mock(UpdateRequest.class); JsonValue content = new JsonValue("content"); given(request.getContent()).willReturn(content); Privilege privilege = mockPrivilege(id, lastModified); given(mockParser.parsePolicy(id, content)).willReturn(privilege); given(mockStore.update(id, privilege)).willReturn(privilege); Promise<ResourceResponse, ResourceException> promise = policyResource.updateInstance(mockServerContext, id, request); assertThat(promise).succeeded().withId().isNotNull(); }