### Question:
CoreTokenResource implements CollectionResourceProvider { public Promise<ResourceResponse, ResourceException> updateInstance(Context serverContext, String tokenId, UpdateRequest updateRequest) { String principal = PrincipalRestUtils.getPrincipalNameFromServerContext(serverContext); String value = updateRequest.getContent().toString(); Token newToken = serialisation.deserialise(value, Token.class); try { store.updateAsync(newToken); ResourceResponse resource = newResourceResponse( newToken.getTokenId(), String.valueOf(System.currentTimeMillis()), new JsonValue("Token Updated")); debug("UPDATE by {0}: Updated token resource with ID: {1}", principal, tokenId); return newResultPromise(resource); } catch (CoreTokenException e) { error(e, "UPDATE by {0}: Error updating token resource with ID: {1}", principal, tokenId); return generateException(e).asPromise(); } } CoreTokenResource(JSONSerialisation serialisation, CTSPersistentStore store, Debug debug); Promise<ResourceResponse, ResourceException> createInstance(Context serverContext,
            CreateRequest createRequest); Promise<ResourceResponse, ResourceException> deleteInstance(Context serverContext, String tokenId,
            DeleteRequest deleteRequest); Promise<ResourceResponse, ResourceException> readInstance(Context serverContext, String tokenId,
            ReadRequest readRequest); Promise<ResourceResponse, ResourceException> updateInstance(Context serverContext, String tokenId,
            UpdateRequest updateRequest); Promise<QueryResponse, ResourceException> queryCollection(Context serverContext,
            QueryRequest queryRequest, QueryResourceHandler queryResultHandler); Promise<ResourceResponse, ResourceException> patchInstance(Context serverContext, String s,
            PatchRequest patchRequest); Promise<ActionResponse, ResourceException> actionInstance(Context serverContext, String s,
            ActionRequest actionRequest); Promise<ActionResponse, ResourceException> actionCollection(Context serverContext,
            ActionRequest actionRequest); static final String DEBUG_HEADER; }### Answer:
@Test public void shouldUpdateUsingTokenInUpdateRequest() throws CoreTokenException { UpdateRequest updateRequest = mock(UpdateRequest.class); JsonValue value = mock(JsonValue.class); given(value.toString()).willReturn("{ \"value\": \"test\" }"); given(updateRequest.getContent()).willReturn(value); given(mockSerialisation.deserialise(anyString(), Matchers.<Class<Object>>any())).willReturn(mockToken); resource.updateInstance(null, "badger", updateRequest); verify(mockStore).updateAsync(any(Token.class)); }