@@ -0,0 +1,2088 @@
+package org.actio.modeler.infrastructure.repository;%0A%0Aimport static org.junit.Assert.*;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport org.actio.commons.message.metrics.MetricsMessage;%0Aimport org.actio.commons.message.model.ModelMessage;%0Aimport org.actio.commons.message.process.DeployProcessRequestMessage;%0Aimport org.actio.commons.message.process.ProcessMessage;%0Aimport org.actio.modeler.infrastructure.config.ModelerConfigurationProperties;%0Aimport org.actio.modeler.infrastructure.config.ModelerConfigurationProperties.Engine;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.ArgumentCaptor;%0Aimport org.mockito.Captor;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Mock;%0Aimport org.mockito.Mockito;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.web.client.RestTemplate;%0A%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class ModelRepositoryImplTest %7B%0A%0A%09@Mock%0A%09private RestTemplate restTemplate;%0A%09@Mock%0A%09private ModelerConfigurationProperties configuration;%0A%09%0A%09@InjectMocks%0A%09private ModelRepositoryImpl testObj;%0A%09%0A%09@Mock%0A%09private ModelMessage message;%0A%09@Mock%0A%09private Engine engine;%0A%09%0A%09@Captor%0A%09private ArgumentCaptor%3CDeployProcessRequestMessage%3E captor;%0A%09%0A%09@Mock%0A%09private ProcessMessage processMesage;%0A%09%0A%09@Test%0A%09public void testAdd() %7B%0A%09%09when(configuration.getEngine()).thenReturn(engine);%0A%09%09when(engine.getUrlFormat()).thenReturn(%22http://actio.org/%7Bactiviti%7D%22);%0A%09%09when(message.getId()).thenReturn(%22myId%22);%0A%09%09when(restTemplate.postForObject(%22http://actio.org/%7Bactiviti%7D%22, message, ModelMessage.class, %22models%22))%0A%09%09%09%09.thenReturn(message);%0A%09%09when(restTemplate.postForObject(Mockito.eq(%22http://actio.org/%7Bactiviti%7D%22), captor.capture(), Mockito.eq(ProcessMessage.class), Mockito.eq(%22processes%22)))%0A%09%09%09%09.thenReturn(processMesage);%0A%09%09ModelMessage modelMessage = testObj.add(message);%0A%09%09// assert%0A%09%09assertEquals(message, modelMessage);%0A%09%09assertEquals(%22myId%22, captor.getValue().getModelId());%0A%09%7D%0A%0A%09@Test%0A%09public void testGetAllModels() %7B%0A//%09%09fail(%22Not yet implemented%22);%0A%09%7D%0A%0A%7D%0A

Add test for ModelRepositoryImpl