### Question:
RecordResource implements CollectionResourceProvider { @Override public Promise<ActionResponse, ResourceException> actionCollection(Context serverContext, ActionRequest actionRequest) { switch (actionRequest.getAction()) { case RecordConstants.START_ACTION: return actionStart(actionRequest.getContent()); case RecordConstants.STATUS_ACTION: return actionStatus(); case RecordConstants.STOP_ACTION: return actionStop(); default: return RestUtils.generateUnsupportedOperation(); } } @Inject  RecordResource(DebugRecorder debugRecorder); @Override Promise<ActionResponse, ResourceException> actionCollection(Context serverContext,
            ActionRequest actionRequest); @Override Promise<ActionResponse, ResourceException> actionInstance(Context serverContext, String s,
            ActionRequest actionRequest); @Override Promise<ResourceResponse, ResourceException> createInstance(Context serverContext,
            CreateRequest createRequest); @Override Promise<ResourceResponse, ResourceException> deleteInstance(Context serverContext, String s,
            DeleteRequest deleteRequest); @Override Promise<ResourceResponse, ResourceException> patchInstance(Context serverContext, String s,
            PatchRequest patchRequest); @Override Promise<QueryResponse, ResourceException> queryCollection(Context serverContext, QueryRequest queryRequest,
            QueryResourceHandler queryResultHandler); @Override Promise<ResourceResponse, ResourceException> readInstance(Context serverContext, String s,
            ReadRequest readRequest); @Override Promise<ResourceResponse, ResourceException> updateInstance(Context serverContext, String s,
            UpdateRequest updateRequest);  }### Answer:
@Test public void startRecording() throws IOException, ExecutionException, InterruptedException { JsonValue jsonRecordProperties = JsonValueBuilder.toJsonValue( IOUtils.getFileContentFromClassPath(RecordResourceTest.class, RECORD_DIRECTORY + "startSimpleRecord.json")); given(request.getAction()).willReturn("start"); given(request.getContent()).willReturn(jsonRecordProperties); Promise<ActionResponse, ResourceException> promise = recordResource.actionCollection(serverContext, request); verify(request).getAction(); RecordProperties recordPropertiesInput = RecordProperties.fromJson(jsonRecordProperties); RecordProperties recordPropertiesOutput = RecordProperties.fromJson(promise.get().getJsonContent().get("record")); assertThat(recordPropertiesInput).isEqualTo(recordPropertiesOutput); }
@Test public void stopRecording() throws IOException, RecordException, ExecutionException, InterruptedException { JsonValue jsonRecordProperties = JsonValueBuilder.toJsonValue( IOUtils.getFileContentFromClassPath(RecordResourceTest.class, RECORD_DIRECTORY + "startSimpleRecord.json")); debugRecorder.startRecording(jsonRecordProperties); given(request.getAction()).willReturn("stop"); Promise<ActionResponse, ResourceException> promise = recordResource.actionCollection(serverContext, request); verify(request).getAction(); RecordProperties recordPropertiesInput = RecordProperties.fromJson(jsonRecordProperties); RecordProperties recordPropertiesOutput = RecordProperties.fromJson(promise.get().getJsonContent().get("record")); assertThat(recordPropertiesInput).isEqualTo(recordPropertiesOutput); }