diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusCommand.java b/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusCommand.java
index cee5af6..6685a63 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusCommand.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/InProgressStatusCommand.java
@@ -23,6 +23,7 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.collect.ImmutableMap;
 import io.joshworks.restclient.http.HttpResponse;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.vid.job.Job.JobStatus;
 import org.onap.vid.job.JobCommand;
 import org.onap.vid.job.NextCommand;
@@ -30,13 +31,13 @@
 import org.onap.vid.mso.rest.AsyncRequestStatus;
 import org.onap.vid.services.AsyncInstantiationBusinessLogic;
 import org.onap.vid.services.AuditService;
-import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.springframework.beans.factory.config.ConfigurableBeanFactory;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 
 import javax.inject.Inject;
 import java.util.Map;
+import java.util.Objects;
 import java.util.UUID;
 
 
@@ -68,33 +69,38 @@
         init(jobUuid, requestId);
     }
 
+    InProgressStatusCommand(AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic, MsoInterface msoInterface, AuditService auditService, UUID jobUuid, String requestId) {
+        this(jobUuid, requestId);
+        this.asyncInstantiationBL = asyncInstantiationBusinessLogic;
+        this.restMso = msoInterface;
+        this.auditService = auditService;
+    }
+
     @Override
     public NextCommand call() {
 
         try {
-            String path = asyncInstantiationBL.getOrchestrationRequestsPath()+"/"+requestId;
+            String path = asyncInstantiationBL.getOrchestrationRequestsPath() + "/" + requestId;
             HttpResponse<AsyncRequestStatus> msoResponse = restMso.get(path, AsyncRequestStatus.class);
 
 
             JobStatus jobStatus;
             if (msoResponse.getStatus() >= 400 || msoResponse.getBody() == null) {
-                auditService.setFailedAuditStatusFromMso(jobUuid, requestId, msoResponse.getStatus(), msoResponse.getBody().toString());
+                auditService.setFailedAuditStatusFromMso(jobUuid, requestId, msoResponse.getStatus(), Objects.toString(msoResponse.getBody()));
                 LOGGER.error(EELFLoggerDelegate.errorLogger,
                         "Failed to get orchestration status for {}. Status code: {},  Body: {}",
-                        requestId, msoResponse.getStatus(), msoResponse.getRawBody().toString());
+                        requestId, msoResponse.getStatus(), Objects.toString(msoResponse.getRawBody()));
                 return new NextCommand(JobStatus.IN_PROGRESS, this);
-            }
-            else {
+            } else {
                 jobStatus = asyncInstantiationBL.calcStatus(msoResponse.getBody());
             }
 
-            asyncInstantiationBL.auditMsoStatus(jobUuid,msoResponse.getBody().request);
+            asyncInstantiationBL.auditMsoStatus(jobUuid, msoResponse.getBody().request);
 
 
             if (jobStatus == JobStatus.FAILED) {
                 asyncInstantiationBL.handleFailedInstantiation(jobUuid);
-            }
-            else {
+            } else {
                 asyncInstantiationBL.updateServiceInfoAndAuditStatus(jobUuid, jobStatus);
             }
             //in case of JobStatus.PAUSE we leave the job itself as IN_PROGRESS, for keep tracking job progress
@@ -128,5 +134,4 @@
         return ImmutableMap.of("requestId", requestId);
     }
 
-
 }
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/ServiceInstantiationCommand.java b/vid-app-common/src/main/java/org/onap/vid/job/command/ServiceInstantiationCommand.java
index 9d22b8b..958fc11 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/ServiceInstantiationCommand.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/ServiceInstantiationCommand.java
@@ -42,6 +42,7 @@
 
 import javax.inject.Inject;
 import java.util.Map;
+import java.util.Objects;
 import java.util.UUID;
 
 
@@ -73,6 +74,14 @@
         init(uuid, serviceInstantiationRequest, userId);
     }
 
+    ServiceInstantiationCommand(AsyncInstantiationBusinessLogic asyncInstantiationBL, AuditService auditService, MsoInterface msoInterface,
+                                UUID uuid, ServiceInstantiation serviceInstantiation, String userId) {
+        this(uuid, serviceInstantiation, userId);
+        this.asyncInstantiationBL = asyncInstantiationBL;
+        this.auditService = auditService;
+        this.restMso = msoInterface;
+    }
+
     @Override
     public NextCommand call() {
         RequestDetailsWrapper<ServiceInstantiationRequestDetails> requestDetailsWrapper ;
@@ -81,7 +90,6 @@
                     uuid, serviceInstantiationRequest, userId
             );
         }
-
         //Aai return bad response while checking names uniqueness
         catch (InvalidAAIResponseException exception) {
             LOGGER.error("Failed to check name uniqueness in AAI. VID will try again later", exception);
@@ -116,7 +124,7 @@
             return new NextCommand(jobStatus, new InProgressStatusCommand(uuid, requestId));
         } else {
             auditService.setFailedAuditStatusFromMso(uuid,null, msoResponse.getStatus(),
-                msoResponse.getBody().toString());
+                    Objects.toString(msoResponse.getBody()));
             return handleCommandFailed();
         }
 
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobAdapterImpl.java b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobAdapterImpl.java
index 77e1dd2..59f12f4 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobAdapterImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobAdapterImpl.java
@@ -33,14 +33,10 @@
     }
 
     @Override
-    public Job createJob(JobType jobType, AsyncJobRequest request, UUID templateId, String userId, Integer indexInBulk){
-        JobDaoImpl job = new JobDaoImpl();
-        job.setStatus(Job.JobStatus.PENDING);
-        job.setTypeAndData(jobType, ImmutableMap.of(
+    public Job createJob(JobType jobType, AsyncJobRequest request, UUID templateId, String userId, Integer indexInBulk) {
+        JobDaoImpl job = createJob(jobType, templateId, indexInBulk, ImmutableMap.of(
                 "request", request,
                 "userId", userId));
-        job.setTemplateId(templateId);
-        job.setIndexInBulk(indexInBulk);
         job.setUserId(userId);
         return job;
     }
@@ -59,14 +55,17 @@
         List<Job> jobList = new ArrayList<>(count + 1);
         UUID templateId = UUID.randomUUID();
         for (int i = 0; i < count; i++) {
-            Job child = new JobDaoImpl();
-            child.setTypeAndData(jobType, bulkRequest);
-            child.setStatus(Job.JobStatus.PENDING);
-            child.setTemplateId(templateId);
-            child.setIndexInBulk(i);
-            jobList.add(child);
+            jobList.add(createJob(jobType, templateId, i, bulkRequest));
         }
         return jobList;
     }
 
+    private JobDaoImpl createJob(JobType jobType, UUID templateId, Integer indexInBulk, Map<String, Object> data) {
+        JobDaoImpl job = new JobDaoImpl();
+        job.setStatus(Job.JobStatus.PENDING);
+        job.setTypeAndData(jobType, data);
+        job.setTemplateId(templateId);
+        job.setIndexInBulk(indexInBulk);
+        return job;
+    }
 }
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/InProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/InProgressStatusCommandTest.java
new file mode 100644
index 0000000..bc62392
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/InProgressStatusCommandTest.java
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.job.command;
+
+
+import io.joshworks.restclient.http.HttpResponse;
+import org.mockito.Mock;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.NextCommand;
+import org.onap.vid.mso.MsoInterface;
+import org.onap.vid.mso.rest.AsyncRequestStatus;
+import org.onap.vid.services.AsyncInstantiationBusinessLogic;
+import org.onap.vid.services.AuditService;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import javax.ws.rs.ProcessingException;
+import java.util.UUID;
+
+
+import static org.assertj.core.api.Java6Assertions.assertThat;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class InProgressStatusCommandTest {
+
+    @Mock
+    private AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic;
+
+    @Mock
+    private MsoInterface msoInterface;
+
+    @Mock
+    private AuditService auditService;
+
+    @Mock
+    private HttpResponse<AsyncRequestStatus> msoResponse;
+
+    @Mock
+    private AsyncRequestStatus asyncRequestStatus;
+
+    @Mock
+    private AsyncRequestStatus.Request request;
+
+    private UUID uuid = UUID.randomUUID();
+
+    private InProgressStatusCommand inProgressStatusCommand;
+
+    @BeforeMethod
+    public void setUp() {
+        initMocks(this);
+
+        inProgressStatusCommand = new InProgressStatusCommand(asyncInstantiationBusinessLogic, msoInterface, auditService, uuid, "sampleRequestId");
+
+        when(asyncInstantiationBusinessLogic.getOrchestrationRequestsPath()).thenReturn("http://localhost:8080/samplePath");
+        when(msoInterface.get("http://localhost:8080/samplePath/sampleRequestId", AsyncRequestStatus.class)).thenReturn(msoResponse);
+        when(msoResponse.getBody()).thenReturn(asyncRequestStatus);
+    }
+
+
+    @Test
+    public void whenSOReturnsErrorShouldSetProperFailureStateAndReturnRetryCommand() {
+        when(msoResponse.getStatus()).thenReturn(500);
+
+        NextCommand call = inProgressStatusCommand.call();
+
+        assertThat(call.getStatus()).isEqualTo(Job.JobStatus.IN_PROGRESS);
+        assertThat(call.getCommand()).isEqualTo(inProgressStatusCommand);
+
+        verify(auditService).setFailedAuditStatusFromMso(uuid, "sampleRequestId", 500, asyncRequestStatus.toString());
+    }
+
+    @Test
+    public void shouldProperlyHandleFailedInstantiation() {
+        when(msoResponse.getStatus()).thenReturn(200);
+        when(asyncInstantiationBusinessLogic.calcStatus(asyncRequestStatus)).thenReturn(Job.JobStatus.FAILED);
+        asyncRequestStatus.request = request;
+
+        NextCommand call = inProgressStatusCommand.call();
+
+        assertThat(call.getCommand()).isEqualTo(inProgressStatusCommand);
+        assertThat(call.getStatus()).isEqualTo(Job.JobStatus.FAILED);
+
+        verify(asyncInstantiationBusinessLogic).handleFailedInstantiation(uuid);
+        verify(asyncInstantiationBusinessLogic).auditMsoStatus(uuid, request);
+    }
+
+    @Test
+    public void shouldRetryCommandWithPausedState() {
+        when(msoResponse.getStatus()).thenReturn(200);
+        when(asyncInstantiationBusinessLogic.calcStatus(asyncRequestStatus)).thenReturn(Job.JobStatus.PAUSE);
+        asyncRequestStatus.request = request;
+
+        NextCommand call = inProgressStatusCommand.call();
+
+        assertThat(call.getCommand()).isEqualTo(inProgressStatusCommand);
+        assertThat(call.getStatus()).isEqualTo(Job.JobStatus.IN_PROGRESS);
+
+        verify(asyncInstantiationBusinessLogic).auditMsoStatus(uuid, request);
+        verify(asyncInstantiationBusinessLogic).updateServiceInfoAndAuditStatus(uuid, Job.JobStatus.PAUSE);
+    }
+
+    @Test
+    public void shouldRetryCommandExitedWithProcessingException() {
+        when(msoResponse.getStatus()).thenReturn(200);
+        when(asyncInstantiationBusinessLogic.calcStatus(asyncRequestStatus)).thenThrow(new ProcessingException(""));
+
+        NextCommand call = inProgressStatusCommand.call();
+
+        assertThat(call.getCommand()).isEqualTo(inProgressStatusCommand);
+        assertThat(call.getStatus()).isEqualTo(Job.JobStatus.IN_PROGRESS);
+    }
+
+    @Test
+    public void shouldSetStoppedStatusWhenRuntimeExceptionOccurs() {
+        when(msoResponse.getStatus()).thenReturn(200);
+        when(asyncInstantiationBusinessLogic.calcStatus(asyncRequestStatus)).thenThrow(new RuntimeException());
+
+        NextCommand call = inProgressStatusCommand.call();
+
+        assertThat(call.getCommand()).isEqualTo(inProgressStatusCommand);
+        assertThat(call.getStatus()).isEqualTo(Job.JobStatus.STOPPED);
+    }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInstantiationCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInstantiationCommandTest.java
new file mode 100644
index 0000000..e7ab4f0
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInstantiationCommandTest.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.job.command;
+
+
+import io.joshworks.restclient.http.HttpResponse;
+import org.mockito.Mock;
+import org.onap.vid.aai.AaiResponse;
+import org.onap.vid.aai.exceptions.InvalidAAIResponseException;
+import org.onap.vid.changeManagement.RequestDetailsWrapper;
+import org.onap.vid.domain.mso.RequestReferences;
+import org.onap.vid.exceptions.MaxRetriesException;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.NextCommand;
+import org.onap.vid.model.RequestReferencesContainer;
+import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
+import org.onap.vid.mso.MsoInterface;
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails;
+import org.onap.vid.services.AsyncInstantiationBusinessLogic;
+import org.onap.vid.services.AuditService;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.UUID;
+
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class ServiceInstantiationCommandTest {
+    @Mock
+    private AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic;
+
+    @Mock
+    private MsoInterface msoInterface;
+
+    @Mock
+    private AuditService auditService;
+
+    @Mock
+    private ServiceInstantiation serviceInstantiation;
+
+    @Mock
+    private HttpResponse<RequestReferencesContainer> msoResponse;
+
+    @Mock
+    private RequestDetailsWrapper<ServiceInstantiationRequestDetails> requestDetailsWrapper;
+
+    @Mock
+    private AaiResponse aaiResponse;
+
+    @Mock
+    private RequestReferencesContainer requestReferencesContainer;
+
+
+    private UUID uuid = UUID.randomUUID();
+
+
+    private ServiceInstantiationCommand serviceInstantiationCommand;
+
+    @BeforeMethod
+    public void setUp() {
+        initMocks(this);
+        serviceInstantiationCommand = new ServiceInstantiationCommand(asyncInstantiationBusinessLogic, auditService, msoInterface, uuid, serviceInstantiation, "sampleUserId");
+    }
+
+
+    @Test
+    public void shouldProperlyHandleMaxRetriesException() {
+        when(asyncInstantiationBusinessLogic.generateServiceInstantiationRequest(uuid, serviceInstantiation, "sampleUserId")).thenThrow(new MaxRetriesException("", 2));
+
+        NextCommand call = serviceInstantiationCommand.call();
+
+        assertThat(call.getCommand(), is(nullValue()));
+        assertThat(call.getStatus(), is(equalTo(Job.JobStatus.FAILED)));
+
+        verify(asyncInstantiationBusinessLogic).handleFailedInstantiation(uuid);
+    }
+
+    @Test
+    public void shouldProperlyHandleInvalidAAIResponseException() {
+        doThrow(new InvalidAAIResponseException(aaiResponse)).when(asyncInstantiationBusinessLogic).generateServiceInstantiationRequest(uuid, serviceInstantiation, "sampleUserId");
+
+        NextCommand call = serviceInstantiationCommand.call();
+
+        assertThat(call.getCommand(), is(serviceInstantiationCommand));
+        assertThat(call.getStatus(), is(equalTo(Job.JobStatus.IN_PROGRESS)));
+    }
+
+
+    @Test
+    public void shouldProperlyHandleInvalidSOResponse() {
+        when(asyncInstantiationBusinessLogic.generateServiceInstantiationRequest(uuid, serviceInstantiation, "sampleUserId")).thenReturn(requestDetailsWrapper);
+        when(asyncInstantiationBusinessLogic.getServiceInstantiationPath(serviceInstantiation)).thenReturn("samplePath");
+        when(msoInterface.post("samplePath", requestDetailsWrapper, RequestReferencesContainer.class)).thenReturn(msoResponse);
+        when(msoResponse.getStatus()).thenReturn(500);
+        when(msoResponse.getBody()).thenReturn(requestReferencesContainer);
+
+        NextCommand call = serviceInstantiationCommand.call();
+
+        assertThat(call.getCommand(), is(nullValue()));
+        assertThat(call.getStatus(), is(equalTo(Job.JobStatus.FAILED)));
+
+        verify(auditService).setFailedAuditStatusFromMso(uuid, null, 500, requestReferencesContainer.toString());
+    }
+
+
+    @Test
+    public void shouldProperlyUpdateServiceStatusAndReturnInProgressCommand() {
+        RequestReferences requestReferences = createRequestReferences();
+
+        when(asyncInstantiationBusinessLogic.generateServiceInstantiationRequest(uuid, serviceInstantiation, "sampleUserId")).thenReturn(requestDetailsWrapper);
+        when(asyncInstantiationBusinessLogic.getServiceInstantiationPath(serviceInstantiation)).thenReturn("samplePath");
+        when(msoInterface.post("samplePath", requestDetailsWrapper, RequestReferencesContainer.class)).thenReturn(msoResponse);
+        when(msoResponse.getStatus()).thenReturn(200);
+        when(msoResponse.getBody()).thenReturn(requestReferencesContainer);
+        when(requestReferencesContainer.getRequestReferences()).thenReturn(requestReferences);
+
+
+        NextCommand call = serviceInstantiationCommand.call();
+
+        assertThat(call.getCommand(), instanceOf(InProgressStatusCommand.class));
+        assertThat(call.getStatus(), is(equalTo(Job.JobStatus.IN_PROGRESS)));
+
+    }
+
+    private RequestReferences createRequestReferences() {
+        RequestReferences requestReferences = new RequestReferences();
+        requestReferences.setInstanceId("sampleInstanceId");
+        requestReferences.setRequestId("sampleRequestId");
+        return requestReferences;
+    }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobAdapterImplTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobAdapterImplTest.java
new file mode 100644
index 0000000..dc2eafc
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobAdapterImplTest.java
@@ -0,0 +1,110 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.job.impl;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.mockito.Mock;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobType;
+import org.onap.vid.model.JobBulk;
+import org.onap.vid.model.JobModel;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.util.List;
+import java.util.UUID;
+import java.util.stream.Stream;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class JobAdapterImplTest {
+
+
+    private static final int SAMPLE_INDEX = 10;
+    private static final String SAMPLE_USER_ID = "sampleUserId";
+
+    @Mock
+    private Job job;
+
+    @Mock
+    private JobAdapter.AsyncJobRequest asyncJobRequest;
+
+    private UUID sampleUuid=UUID.randomUUID();
+
+    private JobAdapterImpl jobAdapter = new JobAdapterImpl();
+
+    @BeforeMethod
+    public void setUp() {
+        initMocks(this);
+
+        when(job.getUuid()).thenReturn(sampleUuid);
+        when(job.getStatus()).thenReturn(Job.JobStatus.IN_PROGRESS);
+        when(job.getTemplateId()).thenReturn(sampleUuid);
+    }
+
+    @Test
+    public void shouldConvertJobToJobModel() {
+
+
+        JobModel convertedJob = jobAdapter.toModel(job);
+
+        assertThat(convertedJob.getUuid()).isEqualByComparingTo(sampleUuid);
+        assertThat(convertedJob.getStatus()).isEqualByComparingTo(Job.JobStatus.IN_PROGRESS);
+        assertThat(convertedJob.getTemplateId()).isEqualByComparingTo(sampleUuid);
+    }
+
+
+    @Test
+    public void shouldProperlyCreateJob() {
+        UUID uuid = UUID.randomUUID();
+
+        Job createdJob = jobAdapter.createJob(JobType.ServiceInstantiation, asyncJobRequest, uuid, SAMPLE_USER_ID, SAMPLE_INDEX);
+
+        assertThat(createdJob.getStatus()).isEqualByComparingTo(Job.JobStatus.PENDING);
+        assertThat(createdJob.getTemplateId()).isEqualByComparingTo(uuid);
+        assertThat(createdJob.getType()).isEqualByComparingTo(JobType.ServiceInstantiation);
+        assertThat(createdJob.getData()).isEqualTo(ImmutableMap.of("request", asyncJobRequest, "userId", SAMPLE_USER_ID));
+    }
+
+    @Test
+    public void shouldProperlyCreateBulkOfJobs(){
+        List<Job> bulkOfJobs = jobAdapter.createBulkOfJobs(ImmutableMap.of("count", 5, "type", JobType.InProgressStatus.name()));
+
+
+        assertThat(bulkOfJobs).hasSize(5);
+
+        Stream<Job> jobStream = bulkOfJobs.stream().filter(x -> JobType.InProgressStatus.equals(x.getType()) && Job.JobStatus.PENDING.equals(x.getStatus()));
+
+        assertThat(jobStream).hasSize(5);
+    }
+
+
+    @Test
+    public void shouldConvertListToBulkJob(){
+        JobBulk jobBulk = jobAdapter.toModelBulk(ImmutableList.of(job, job));
+
+        assertThat(jobBulk.getJobs()).hasSize(2);
+    }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobSchedulerInitializerTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobSchedulerInitializerTest.java
new file mode 100644
index 0000000..93afd17
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobSchedulerInitializerTest.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2018 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.job.impl;
+
+
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.onap.vid.job.JobsBrokerService;
+import org.onap.vid.job.command.JobCommandFactory;
+import org.onap.vid.properties.Features;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.springframework.scheduling.quartz.SchedulerFactoryBean;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
+public class JobSchedulerInitializerTest {
+
+    @Mock
+    private JobsBrokerService brokerService;
+
+    @Mock
+    private SchedulerFactoryBean schedulerFactoryBean;
+
+    @Mock
+    private FeatureManager featureManager;
+
+    @Mock
+    private JobCommandFactory commandFactory;
+
+    @Mock
+    private Scheduler scheduler;
+
+    @InjectMocks
+    private JobSchedulerInitializer jobSchedulerInitializer;
+
+    @BeforeMethod
+    public void setUp() {
+        initMocks(this);
+    }
+
+
+    @Test
+    public void shouldNotInitializeSchedulerWhenAsyncJobsAreDisabled() {
+        when(featureManager.isActive(Features.FLAG_ASYNC_JOBS)).thenReturn(false);
+
+        jobSchedulerInitializer.init();
+
+        verifyZeroInteractions(schedulerFactoryBean);
+    }
+
+
+    @Test
+    public void shouldInitializeSchedulerWhenAsyncJobsAreEnabled() throws SchedulerException {
+        ArgumentCaptor<JobDetail> jobDetailArgumentCaptor = ArgumentCaptor.forClass(JobDetail.class);
+        ArgumentCaptor<Trigger> triggerArgumentCaptor = ArgumentCaptor.forClass(Trigger.class);
+        when(featureManager.isActive(Features.FLAG_ASYNC_JOBS)).thenReturn(true);
+        when(schedulerFactoryBean.getScheduler()).thenReturn(scheduler);
+
+        jobSchedulerInitializer.init();
+
+        verify(scheduler, times(2)).scheduleJob(jobDetailArgumentCaptor.capture(), triggerArgumentCaptor.capture());
+
+        List<Object> topics = extractTopics(jobDetailArgumentCaptor);
+
+        List<String> descriptions = extractDescription(triggerArgumentCaptor);
+
+        assertThat(topics, containsInAnyOrder(org.onap.vid.job.Job.JobStatus.IN_PROGRESS, org.onap.vid.job.Job.JobStatus.PENDING));
+        assertThat(descriptions, containsInAnyOrder("Trigger to run async worker for PENDING", "Trigger to run async worker for IN_PROGRESS"));
+    }
+
+    private List<Object> extractTopics(ArgumentCaptor<JobDetail> jobDetailArgumentCaptor) {
+        return jobDetailArgumentCaptor
+                .getAllValues()
+                .stream()
+                .map(JobDetail::getJobDataMap)
+                .map(x -> x.get("topic"))
+                .collect(Collectors.toList());
+    }
+
+    private List<String> extractDescription(ArgumentCaptor<Trigger> triggerArgumentCaptor) {
+        return triggerArgumentCaptor
+                .getAllValues()
+                .stream()
+                .map(Trigger::getDescription)
+                .collect(Collectors.toList());
+    }
+}
\ No newline at end of file
