@@ -0,0 +1,3275 @@
+package org.openlmis.core.model.repository;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.openlmis.core.LMISRepositoryUnitTest;%0Aimport org.openlmis.core.LMISTestRunner;%0Aimport org.openlmis.core.exceptions.LMISException;%0Aimport org.openlmis.core.model.Program;%0Aimport org.openlmis.core.model.Service;%0Aimport org.robolectric.RuntimeEnvironment;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport roboguice.RoboGuice;%0A%0Aimport static org.hamcrest.Matchers.empty;%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.hamcrest.Matchers.nullValue;%0Aimport static org.junit.Assert.assertThat;%0A%0A@RunWith(LMISTestRunner.class)%0Apublic class ServiceFormRepositoryTest extends LMISRepositoryUnitTest %7B%0A    ServiceFormRepository serviceFormRepository;%0A    private Service service;%0A%0A    @Before%0A    public void setup() throws LMISException %7B%0A        serviceFormRepository = RoboGuice%0A                .getInjector(RuntimeEnvironment.application)%0A                .getInstance(ServiceFormRepository.class);%0A        service = new Service();%0A        service.setCode(%22serviceCode%22);%0A        service.setName(%22serviceName%22);%0A        service.setActive(false);%0A    %7D%0A%0A    @Test%0A    public void shouldQueryByCode() throws LMISException %7B%0A        Service result = serviceFormRepository.queryByCode(service.getCode());%0A        assertThat(result, is(nullValue()));%0A    %7D%0A%0A    @Test%0A    public void shouldListAllActive() throws LMISException %7B%0A        List%3CService%3E result = serviceFormRepository.listAllActive();%0A        assertThat(result, is(empty()));%0A    %7D%0A%0A    @Test%0A    public void shouldListAllActiveWithProgram() throws LMISException %7B%0A        Program program = new Program();%0A        program.setId(123L);%0A        List%3CService%3E result = serviceFormRepository.listAllActiveWithProgram(program);%0A        assertThat(result, is(empty()));%0A    %7D%0A%0A    @Test%0A    public void shouldCreateOrUpdate() throws LMISException %7B%0A        Service result = serviceFormRepository.queryByCode(service.getCode());%0A        assertThat(result, is(nullValue()));%0A        serviceFormRepository.createOrUpdate(service);%0A        result = serviceFormRepository.queryByCode(service.getCode());%0A        assertThat(result.getCode(), is(service.getCode()));%0A%0A        result.setName(%22change service name%22);%0A        serviceFormRepository.createOrUpdate(result);%0A        assertThat(serviceFormRepository.queryByCode(service.getCode()).getName(), is(result.getName()));%0A    %7D%0A%0A    @Test%0A    public void shouldBatchCreateOrUpdate() throws LMISException %7B%0A        Service result = serviceFormRepository.queryByCode(service.getCode());%0A        assertThat(result, is(nullValue()));%0A        List%3CService%3E serviceList = new ArrayList%3C%3E();%0A        serviceList.add(service);%0A        serviceFormRepository.batchCreateOrUpdateServiceList(serviceList);%0A        result = serviceFormRepository.queryByCode(service.getCode());%0A        assertThat(result.getCode(), is(service.getCode()));%0A%0A        result.setName(%22change service name%22);%0A        serviceList.clear();%0A        serviceList.add(result);%0A        serviceFormRepository.batchCreateOrUpdateServiceList(serviceList);%0A        assertThat(serviceFormRepository.queryByCode(service.getCode()).getName(), is(result.getName()));%0A    %7D%0A%0A%7D%0A

add ServiceFormRepository test