Package com.infoclinika.mssharing.web

Source Code of com.infoclinika.mssharing.web.MockTranslationService

package com.infoclinika.mssharing.web;

import com.infoclinika.msexplorer.messaging.api.ExperimentWorkflowType;
import com.infoclinika.msexplorer.messaging.api.InstrumentVendorType;
import com.infoclinika.web.Service;
import org.mockito.Mockito;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.springframework.beans.factory.config.AbstractFactoryBean;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import static org.mockito.Matchers.anyListOf;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
* @author Pavel Kaplin
*/
public class MockTranslationService extends AbstractFactoryBean<Service> {

    @Override
    public Class<?> getObjectType() {
        return Service.class;
    }

    @Override
    protected Service createInstance() throws Exception {
        Service translationService = mock(Service.class);
       /* when(translationService.translateFiles(anyListOf(String.class), Mockito.<ExperimentWorkflowType>anyObject(),
                Mockito.<InstrumentVendorType>anyObject(), anyString(), anyString())).thenAnswer(new Answer<Service.TranslationResult>() {
            @Override
            public Service.TranslationResult answer(InvocationOnMock invocation) throws Throwable {
                List<String> fileUrls = (List<String>) invocation.getArguments()[0];
                return new Service.TranslationResult(new ArrayList<Long>(Collections.nCopies(fileUrls.size(), 0L)));
            }
        });*/
        return translationService;
    }
}
TOP

Related Classes of com.infoclinika.mssharing.web.MockTranslationService

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.