diff --git a/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java
index 58406a6..3c8250b 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controllers/ChangeManagementControllerTest.java
@@ -1,157 +1,455 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright 2018 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
 package org.onap.vid.controllers;
 
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.BDDMockito.willThrow;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.isA;
+import static org.onap.vid.controllers.ChangeManagementController.CHANGE_MANAGEMENT;
+import static org.onap.vid.controllers.ChangeManagementController.GET_VNF_WORKFLOW_RELATION;
+import static org.onap.vid.controllers.ChangeManagementController.SCHEDULER_BY_SCHEDULE_ID;
+import static org.onap.vid.controllers.ChangeManagementController.VNF_WORKFLOW_RELATION;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableList;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Scanner;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.log4j.BasicConfigurator;
 import org.json.simple.JSONArray;
+import org.junit.Before;
 import org.junit.Test;
-import org.onap.vid.changeManagement.ChangeManagementRequest;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
 import org.onap.vid.changeManagement.GetVnfWorkflowRelationRequest;
-import org.onap.vid.changeManagement.VnfWorkflowRelationRequest;
-import org.onap.vid.mso.MsoResponseWrapperInterface;
-import org.onap.vid.services.ChangeManagementServiceImpl;
-import org.onap.vid.services.WorkflowServiceImpl;
+import org.onap.vid.changeManagement.GetWorkflowsResponse;
+import org.onap.vid.changeManagement.VnfDetailsWithWorkflows;
+import org.onap.vid.changeManagement.VnfWorkflowRelationAllResponse;
+import org.onap.vid.changeManagement.VnfWorkflowRelationResponse;
+import org.onap.vid.domain.mso.InstanceIds;
+import org.onap.vid.domain.mso.RequestStatus;
+import org.onap.vid.exceptions.NotFoundException;
+import org.onap.vid.model.ExceptionResponse;
+import org.onap.vid.mso.rest.Request;
+import org.onap.vid.services.ChangeManagementService;
+import org.onap.vid.services.WorkflowService;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
 import org.springframework.web.multipart.MultipartFile;
 
-import javax.servlet.http.HttpServletRequest;
-import java.util.Collection;
-
+@RunWith(MockitoJUnitRunner.class)
 public class ChangeManagementControllerTest {
 
-    private ChangeManagementController createTestSubject() {
-        return new ChangeManagementController(new WorkflowServiceImpl(), new ChangeManagementServiceImpl(null, null, null),
-                null);
+    private static final String FILE_NAME = "file";
+    private static final String GET_VNF_WORKFLOW_RELATION_URL =
+        "/" + CHANGE_MANAGEMENT + "/" + GET_VNF_WORKFLOW_RELATION;
+    private static final String WORKFLOW_URL = "/" + CHANGE_MANAGEMENT + "/workflow";
+    private static final String WORKFLOW_NAME_URL = WORKFLOW_URL + "/{name}";
+    private static final String MSO_URL = "/" + CHANGE_MANAGEMENT + "/mso";
+    private static final String UPLOAD_CONFIG_UPDATE_FILE_URL = "/" + CHANGE_MANAGEMENT + "/uploadConfigUpdateFile";
+    private static final String SCHEDULER_URL = "/" + CHANGE_MANAGEMENT + "/scheduler";
+    private static final String SCHEDULER_BY_SCHEDULE_ID_URL = "/" + CHANGE_MANAGEMENT + SCHEDULER_BY_SCHEDULE_ID;
+    private static final String VNF_WORKFLOW_RELATION_URL = "/" + CHANGE_MANAGEMENT + "/" + VNF_WORKFLOW_RELATION;
+    private static final String VNFS = "vnfs";
+
+    private static final String FAILED_TO_GET_MSG = "Failed to get workflows for vnf";
+    private static final String FAILED_TO_ADD_MSG = "Failed to add vnf to workflow relation";
+    private static final String FAILED_TO_GET_ALL_MSG = "Failed to get all vnf to workflow relations";
+    private static final String FAILED_TO_DELETE_MSG = "Failed to delete vnf from workflow relation";
+
+    private final ObjectMapper objectMapper = new ObjectMapper();
+    private ChangeManagementController controller;
+    private MockMvc mockMvc;
+    @Mock
+    private WorkflowService workflowService;
+    @Mock
+    private ChangeManagementService changeManagementService;
+    @Mock
+    private Response mockResponse;
+    @Mock
+    private Response.StatusType statusType;
+    private ClassLoader classLoader = getClass().getClassLoader();
+    private final String CHANGE_MANAGEMENT_REQUEST_JSON = getRequestContent("change-management-request.json");
+    private final String GET_VNF_WORKFLOW_RELATION_REQUEST_JSON = getRequestContent(
+        "get-vnf-workflow-relation-request.json");
+    private final String VNF_WORKFLOW_RELATION_REQUEST_JSON = getRequestContent("vnf-workflow-relation-request.json");
+
+    @Before
+    public void setUp() {
+        controller = new ChangeManagementController(workflowService, changeManagementService, objectMapper);
+        BasicConfigurator.configure();
+        mockMvc = MockMvcBuilders.standaloneSetup(controller).build();
     }
 
     @Test
-    public void testGetWorkflow() throws Exception {
-        ChangeManagementController testSubject;
-        Collection<String> vnfs = null;
-        ResponseEntity<Collection<String>> result;
+    public void getWorkflow_shouldReturnListOfVnfs_whenServiceReturnsCorrectValue() throws Exception {
 
-        // default test
-        testSubject = createTestSubject();
+        Collection<String> givenVnfs = ImmutableList.of("vnf1", "vnf2", "vnf3");
+        Collection<String> resultWorkflows = ImmutableList.of("workflow1", "workflow2");
+
+        given(
+            workflowService.getWorkflowsForVNFs(argThat(other -> CollectionUtils.isEqualCollection(givenVnfs, other))))
+            .willReturn(resultWorkflows);
+
+        mockMvc.perform(get(WORKFLOW_URL)
+            .param(VNFS, StringUtils.join(givenVnfs, ",")))
+            .andExpect(status().isOk())
+            .andExpect(content().json(objectMapper.writeValueAsString(resultWorkflows)));
+    }
+
+    @Test
+    public void getMSOChangeManagements_shouldReturnCollectionOfRequests_whenServiceReturnsCorrectValue()
+        throws Exception {
+
+        Collection<Request> requests = ImmutableList.of(
+            createRequest("network-instance-id-1", "status-message-1"),
+            createRequest("network-instance-id-2", "status-message-2"));
+
+        given(changeManagementService.getMSOChangeManagements()).willReturn(requests);
+
+        mockMvc.perform(get(MSO_URL))
+            .andExpect(status().isOk())
+            .andExpect(content().json(objectMapper.writeValueAsString(requests)));
+    }
+
+    @Test
+    public void changeManagement_shouldReturnOkResponse_whenServiceReturnsCorrectValue() throws Exception {
+
+        String vnfName = "vnfName1";
+        String jsonBody = "{'param1': 'paramparam'}";
+
+        given(changeManagementService.doChangeManagement(
+            argThat(request -> matches(request, CHANGE_MANAGEMENT_REQUEST_JSON)), eq(vnfName)))
+            .willReturn(ResponseEntity.ok().body(jsonBody));
+
+        mockMvc.perform(post(WORKFLOW_NAME_URL, vnfName)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(CHANGE_MANAGEMENT_REQUEST_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().json(jsonBody));
+    }
+
+    @Test
+    public void uploadConfigUpdateFile_shouldReturnOkResponse_whenServiceReturnsCorrectJson() throws Exception {
+
+        String jsonString = "{'param1': 'paramparam'}";
+        byte[] fileContent = "some file content".getBytes(StandardCharsets.UTF_8);
+        MockMultipartFile file = new MockMultipartFile(FILE_NAME, fileContent);
+
+        given(changeManagementService
+            .uploadConfigUpdateFile(argThat(multipartFileMatcher(file))))
+            .willReturn(jsonString);
+
+        mockMvc.perform(MockMvcRequestBuilders
+            .fileUpload(UPLOAD_CONFIG_UPDATE_FILE_URL)
+            .file(file))
+            .andExpect(status().isOk())
+            .andExpect(content().json(jsonString));
+    }
+
+    @Test
+    public void uploadConfigUpdateFile_shouldReturnResponseStatus_whenServiceThrowsWebApplicationException()
+        throws Exception {
+
+        byte[] fileContent = "some file content".getBytes(StandardCharsets.UTF_8);
+        MockMultipartFile file = new MockMultipartFile(FILE_NAME, fileContent);
+
+        given(statusType.getStatusCode()).willReturn(HttpStatus.NOT_FOUND.value());
+        given(mockResponse.getStatus()).willReturn(HttpStatus.NOT_FOUND.value());
+        given(mockResponse.getStatusInfo()).willReturn(statusType);
+
+        WebApplicationException exception = new WebApplicationException(mockResponse);
+
+        willThrow(exception).given(changeManagementService)
+            .uploadConfigUpdateFile(argThat(multipartFileMatcher(file)));
+
+        mockMvc.perform(MockMvcRequestBuilders
+            .fileUpload(UPLOAD_CONFIG_UPDATE_FILE_URL)
+            .file(file))
+            .andExpect(status().isNotFound())
+            .andExpect(content().json(objectMapper.writeValueAsString(new ExceptionResponse(exception))));
+    }
+
+    @Test
+    public void uploadConfigUpdateFile_shouldReturnInternalServerError_whenServiceThrowsRuntimeException()
+        throws Exception {
+
+        byte[] fileContent = "some file content".getBytes(StandardCharsets.UTF_8);
+        MockMultipartFile file = new MockMultipartFile(FILE_NAME, fileContent);
+
+        RuntimeException exception = new RuntimeException("runtime exception message");
+
+        willThrow(exception).given(changeManagementService)
+            .uploadConfigUpdateFile(argThat(multipartFileMatcher(file)));
+
+        mockMvc.perform(MockMvcRequestBuilders
+            .fileUpload(UPLOAD_CONFIG_UPDATE_FILE_URL)
+            .file(file))
+            .andExpect(status().isInternalServerError())
+            .andExpect(content().json(objectMapper.writeValueAsString(new ExceptionResponse(exception))));
+    }
+
+    @Test
+    public void getSchedulerChangeManagements_shouldReturnJsonArray_whenServiceReturnsCorrectValue() throws Exception {
+
+        JSONArray array = new JSONArray();
+        array.add("element1");
+        array.add("element2");
+
+        given(changeManagementService.getSchedulerChangeManagements()).willReturn(array);
+
+        mockMvc.perform(get(SCHEDULER_URL))
+            .andExpect(status().isOk())
+            .andExpect(content().json(array.toJSONString()));
+    }
+
+    @Test
+    public void deleteSchedule_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+        String id = "schedule-id-1";
+        Pair<String, Integer> pair = new ImmutablePair<>("myString", HttpStatus.OK.value());
+
+        given(changeManagementService.deleteSchedule(id)).willReturn(pair);
+
+        mockMvc.perform(delete(SCHEDULER_BY_SCHEDULE_ID_URL, id))
+            .andExpect(status().isOk());
+    }
+
+    @Test
+    public void deleteSchedule_shouldReturnNotFoundResponse_whenServiceReturnsNotFoundStatus() throws Exception {
+
+        String id = "schedule-id-1";
+        Pair<String, Integer> pair = new ImmutablePair<>("myString", HttpStatus.NOT_FOUND.value());
+
+        given(changeManagementService.deleteSchedule(id)).willReturn(pair);
+
+        mockMvc.perform(delete(SCHEDULER_BY_SCHEDULE_ID_URL, id))
+            .andExpect(status().isNotFound());
+    }
+
+    @Test
+    public void getWorkflows_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+        ImmutableList<String> elements = ImmutableList.of("workflow1", "workflow2");
+        GetWorkflowsResponse response = new GetWorkflowsResponse();
+        response.setWorkflows(elements);
+
+        given(changeManagementService
+            .getWorkflowsForVnf(argThat(request -> matches(request, GET_VNF_WORKFLOW_RELATION_REQUEST_JSON))))
+            .willReturn(elements);
+
+        mockMvc.perform(post(GET_VNF_WORKFLOW_RELATION_URL)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(GET_VNF_WORKFLOW_RELATION_REQUEST_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void getWorkflows_shouldReturnNotFound_whenServiceThrowsNotFoundException() throws Exception {
+
+        String errorMsg = "not found";
+        VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(errorMsg));
+
+        willThrow(new NotFoundException(errorMsg))
+            .given(changeManagementService)
+            .getWorkflowsForVnf(argThat(request -> matches(request, GET_VNF_WORKFLOW_RELATION_REQUEST_JSON)));
+
+        mockMvc.perform(post(GET_VNF_WORKFLOW_RELATION_URL)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(GET_VNF_WORKFLOW_RELATION_REQUEST_JSON))
+            .andExpect(status().isNotFound())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void getWorkflows_shouldReturnInternalServerError_whenServiceThrowsRuntimeException() throws Exception {
+
+        VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_GET_MSG));
+
+        willThrow(new RuntimeException("runtime exception message"))
+            .given(changeManagementService).getWorkflowsForVnf(isA(GetVnfWorkflowRelationRequest.class));
+
+        mockMvc.perform(post(GET_VNF_WORKFLOW_RELATION_URL)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+            .andExpect(status().isInternalServerError())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void createWorkflowRelation_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+        VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse();
+
+        given(changeManagementService
+            .addVnfWorkflowRelation(argThat(request -> matches(request, VNF_WORKFLOW_RELATION_REQUEST_JSON))))
+            .willReturn(response);
+
+        mockMvc.perform(post(VNF_WORKFLOW_RELATION_URL)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void createWorkflowRelation_shouldReturnInternalServerError_whenServiceThrowsException() throws Exception {
+
+        VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_ADD_MSG));
+
+        willThrow(new RuntimeException("runtime exception message"))
+            .given(changeManagementService).addVnfWorkflowRelation(argThat(request -> matches(request,
+            VNF_WORKFLOW_RELATION_REQUEST_JSON)));
+
+        mockMvc.perform(post(VNF_WORKFLOW_RELATION_URL)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+            .andExpect(status().isInternalServerError())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void getAllWorkflowRelation_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+
+        VnfDetailsWithWorkflows workflows = new VnfDetailsWithWorkflows();
+        workflows.setWorkflows(ImmutableList.of("workflow1", "workflow2"));
+        VnfWorkflowRelationAllResponse response = new VnfWorkflowRelationAllResponse(ImmutableList.of(workflows));
+
+        given(changeManagementService.getAllVnfWorkflowRelations()).willReturn(response);
+
+        mockMvc.perform(get(VNF_WORKFLOW_RELATION_URL))
+            .andExpect(status().isOk())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void getAllWorkflowRelation_shouldReturnInternalServerError_whenServiceThrowsRuntimeException()
+        throws Exception {
+
+        VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_GET_ALL_MSG));
+
+        willThrow(new RuntimeException("runtime exception message"))
+            .given(changeManagementService).getAllVnfWorkflowRelations();
+
+        mockMvc.perform(get(VNF_WORKFLOW_RELATION_URL))
+            .andExpect(status().isInternalServerError())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void deleteWorkflowRelation_shouldReturnOkResponse_whenServiceReturnsOkStatus() throws Exception {
+        VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of("abc"));
+
+        given(changeManagementService.deleteVnfWorkflowRelation(argThat(request -> matches(request,
+            VNF_WORKFLOW_RELATION_REQUEST_JSON))))
+            .willReturn(response);
+
+        mockMvc.perform(delete(VNF_WORKFLOW_RELATION_URL)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+            .andExpect(status().isOk())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    @Test
+    public void deleteWorkflowRelation_shouldReturnInternalServerError_whenServiceThrowsRuntimeException()
+        throws Exception {
+        VnfWorkflowRelationResponse response = new VnfWorkflowRelationResponse(ImmutableList.of(FAILED_TO_DELETE_MSG));
+
+        willThrow(new RuntimeException("runtime exception message"))
+            .given(changeManagementService).deleteVnfWorkflowRelation(argThat(request -> matches(request,
+            VNF_WORKFLOW_RELATION_REQUEST_JSON)));
+
+        mockMvc.perform(delete(VNF_WORKFLOW_RELATION_URL)
+            .contentType(MediaType.APPLICATION_JSON)
+            .content(VNF_WORKFLOW_RELATION_REQUEST_JSON))
+            .andExpect(status().isInternalServerError())
+            .andExpect(content().json(objectMapper.writeValueAsString(response)));
+    }
+
+    private <T> boolean matches(T request, String expectedJson) {
         try {
-            result = testSubject.getWorkflow(vnfs);
-        } catch (
-
-        Exception e) {
+            return objectMapper.writeValueAsString(request).equals(expectedJson);
+        } catch (JsonProcessingException e) {
+            System.out.println("Exception occurred: " + e.getMessage());
         }
+        return false;
     }
 
-    @Test
-    public void testGetMSOChangeManagements() throws Exception {
-        ChangeManagementController testSubject;
-
-        // default test
-        testSubject = createTestSubject();
-        try {
-            testSubject.getMSOChangeManagements();
-        } catch (
-
-        Exception e) {
-        }
+    private ArgumentMatcher<MultipartFile> multipartFileMatcher(MultipartFile otherFile) {
+        return other -> {
+            try {
+                return other.getName().equals(otherFile.getName())
+                    && other.getSize() == otherFile.getSize()
+                    && Arrays.equals(other.getBytes(), otherFile.getBytes());
+            } catch (IOException e) {
+                System.out.println("IOException occurred: " + e.getMessage());
+            }
+            return false;
+        };
     }
 
-    @Test
-    public void testChangeManagement() throws Exception {
-        ChangeManagementController testSubject;
-        String vnfName = "";
-        HttpServletRequest request = null;
-        ChangeManagementRequest changeManagmentRequest = null;
-        ResponseEntity<String> result;
+    private Request createRequest(String networkInstanceId, String statusMessage) {
+        Request req = new Request();
+        InstanceIds instanceIds = new InstanceIds();
+        instanceIds.setNetworkInstanceId(networkInstanceId);
 
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.changeManagement(vnfName, request, changeManagmentRequest);
+        RequestStatus requestStatus = new RequestStatus();
+        requestStatus.setStatusMessage(statusMessage);
+
+        req.setInstanceIds(instanceIds);
+        req.setRequestStatus(requestStatus);
+
+        return req;
     }
 
-    @Test
-    public void testUploadConfigUpdateFile() throws Exception {
-        ChangeManagementController testSubject;
-        MultipartFile file = null;
-        ResponseEntity result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.uploadConfigUpdateFile(file);
-    }
-
-    @Test
-    public void testGetSchedulerChangeManagements() throws Exception {
-        ChangeManagementController testSubject;
-        ResponseEntity<JSONArray> result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.getSchedulerChangeManagements();
-    }
-
-    @Test
-    public void testDeleteSchedule() throws Exception {
-        ChangeManagementController testSubject;
-        String scheduleId = "";
-        ResponseEntity result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.deleteSchedule(scheduleId);
-    }
-
-    @Test
-    public void testGetWorkflows() throws Exception {
-        ChangeManagementController testSubject;
-        GetVnfWorkflowRelationRequest getVnfWorkflowRelationRequest = null;
-        ResponseEntity result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.getWorkflows(getVnfWorkflowRelationRequest);
-    }
-
-    @Test
-    public void testCreateWorkflowRelation() throws Exception {
-        ChangeManagementController testSubject;
-        VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
-        ResponseEntity result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.createWorkflowRelation(vnfWorkflowRelationRequest);
-    }
-
-    @Test
-    public void testGetAllWorkflowRelation() throws Exception {
-        ChangeManagementController testSubject;
-        ResponseEntity result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.getAllWorkflowRelation();
-    }
-
-    @Test
-    public void testDeleteWorkflowRelation() throws Exception {
-        ChangeManagementController testSubject;
-        VnfWorkflowRelationRequest vnfWorkflowRelationRequest = null;
-        ResponseEntity result;
-
-        // default test
-        testSubject = createTestSubject();
-        result = testSubject.deleteWorkflowRelation(vnfWorkflowRelationRequest);
-    }
-
-    @Test
-    public void testClientDerivedExceptionAsBadRequest() throws Exception {
-        ChangeManagementController testSubject;
-        Exception e = null;
-        MsoResponseWrapperInterface result;
-
-        // default test
-        try {
-            testSubject = createTestSubject();
-            result = testSubject.clientDerivedExceptionAsBadRequest(e);
-        } catch (
-
-        Exception ex) {
-        }
+    private String getRequestContent(String filename) {
+        InputStream inputStream = classLoader.getResourceAsStream(filename);
+        return new Scanner(inputStream).useDelimiter("\\A").next().replaceAll("\\s+", "");
     }
 }
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/change-management-request.json b/vid-app-common/src/test/resources/change-management-request.json
new file mode 100644
index 0000000..09a33b5
--- /dev/null
+++ b/vid-app-common/src/test/resources/change-management-request.json
@@ -0,0 +1,47 @@
+{
+  "requestDetails": [
+    {
+      "modelInfo": {
+        "modelCustomizationName": "vSAMP12 1",
+        "modelCustomizationId": "c539433a-84a6-4082-a12e-5c9b00c3b960",
+        "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+        "modelVersionId": "254583ad-b38c-498b-bdbd-b8de5e07541b",
+        "modelName": "vSAMP12",
+        "modelType": "vnf",
+        "modelVersion": "2.0"
+      },
+      "cloudConfiguration": {
+        "lcpCloudRegionId": "mdt1",
+        "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+      },
+      "requestInfo": {
+        "source": "VID",
+        "suppressRollback": false,
+        "requestorId": "az2016"
+      },
+      "requestParameters": {
+        "userParams": [],
+        "usePreload": true
+      },
+      "vnfName": "Name",
+      "vnfInstanceId": "Test",
+      "relatedInstanceList": [
+        {
+          "relatedInstance": {
+            "instanceId": "{serviceInstanceId}",
+            "modelInfo": {
+              "modelType": "service",
+              "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+              "modelVersionId": "9ebb1521-2e74-47a4-aac7-e71a79f73a79",
+              "modelName": "{parent service model name}",
+              "modelVersion": "2.0",
+              "modelCustomizationName": "vSAMP12 1",
+              "modelCustomizationId": "c539433a-84a6-4082-a12e-5c9b00c3b960"
+            }
+          }
+        }
+      ]
+    }
+  ],
+  "requestType": null
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/get-vnf-workflow-relation-request.json b/vid-app-common/src/test/resources/get-vnf-workflow-relation-request.json
new file mode 100644
index 0000000..6bc51e6
--- /dev/null
+++ b/vid-app-common/src/test/resources/get-vnf-workflow-relation-request.json
@@ -0,0 +1,28 @@
+{
+  "vnfsDetails": [
+    {
+      "UUID": "uuid-1",
+      "invariantUUID": "invariantUUID-1"
+    },
+    {
+      "UUID": "uuid-2",
+      "invariantUUID": "invariantUUID-2"
+    },
+    {
+      "UUID": "uuid-3",
+      "invariantUUID": "invariantUUID-3"
+    },
+    {
+      "UUID": "uuid-4",
+      "invariantUUID": "invariantUUID-4"
+    },
+    {
+      "UUID": "uuid-5",
+      "invariantUUID": "invariantUUID-5"
+    },
+    {
+      "UUID": "uuid-6",
+      "invariantUUID": "invariantUUID-6"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/vnf-workflow-relation-request.json b/vid-app-common/src/test/resources/vnf-workflow-relation-request.json
new file mode 100644
index 0000000..4794a93
--- /dev/null
+++ b/vid-app-common/src/test/resources/vnf-workflow-relation-request.json
@@ -0,0 +1,25 @@
+{
+  "workflowsDetails": [
+    {
+      "vnfDetails": {
+        "UUID": "uuid-1",
+        "invariantUUID": "invariantUuid-1"
+      },
+      "workflowName": "workflow-name-1"
+    },
+    {
+      "vnfDetails": {
+        "UUID": "uuid-1",
+        "invariantUUID": "invariantUuid-1"
+      },
+      "workflowName": "workflow-name-1"
+    },
+    {
+      "vnfDetails": {
+        "UUID": "uuid-1",
+        "invariantUUID": "invariantUuid-1"
+      },
+      "workflowName": "workflow-name-1"
+    }
+  ]
+}
\ No newline at end of file
