// Path: src/main/java/com/jfcorugedo/rserver/common/collection/CollectionUtils.java
// @SafeVarargs
// public static <T> List<T> newList(T... values) {
// 	List<T> arrayList = new ArrayList<>(values.length);
// 	for(T element : values) {
// 		arrayList.add(element);
// 	}
// 		
// 	return arrayList;
// }


import static com.jfcorugedo.rserver.common.collection.CollectionUtils.newList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPDouble;
import org.rosuda.REngine.REXPInteger;
import org.rosuda.REngine.REXPString;
import org.rosuda.REngine.REngine;
		assertThat(result).isEqualTo(expectedResult);
	}
	
	@Test(expected=REngineException.class)
	public void testThrowsEngineExceptionWhenSomethingGoesWrongCallingSqrt() throws Exception {
		
		when(engine.parseAndEval(anyString())).thenThrow(new RuntimeException("Something goes wrong..."));
		
		service.sqrt(4d);
	}
	
	@Test
	public void testReturnResultWhenCallingSqrt() throws Exception {
		REXP expectedResult = new REXPDouble(2d);
		when(engine.parseAndEval(anyString())).thenReturn(expectedResult);
		
		double result = service.sqrt(4d);
		
		assertThat(result).isEqualTo(2d);
	}
	
	@Test(expected=UnsupportedOperationException.class)
	public void ksTestIsNotImplementedYet() {
		
		service.ksTest(mock(REXPDouble.class), mock(REXPDouble.class));
	}
	
	@Test(expected=UnsupportedOperationException.class)
    public void blockGeneralFunctionIsNotImplementedYet() {
        
// Path: src/main/java/com/jfcorugedo/rserver/common/collection/CollectionUtils.java
// @SafeVarargs
// public static <T> List<T> newList(T... values) {
// 	List<T> arrayList = new ArrayList<>(values.length);
// 	for(T element : values) {
// 		arrayList.add(element);
// 	}
// 		
// 	return arrayList;
// }


// Path: src/test/java/com/jfcorugedo/rserver/engine/JRIEngineProviderServiceTest.java
import static com.jfcorugedo.rserver.common.collection.CollectionUtils.newList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.rosuda.REngine.REXP;
import org.rosuda.REngine.REXPDouble;
import org.rosuda.REngine.REXPInteger;
import org.rosuda.REngine.REXPString;
import org.rosuda.REngine.REngine;

		assertThat(result).isEqualTo(expectedResult);
	}
	
	@Test(expected=REngineException.class)
	public void testThrowsEngineExceptionWhenSomethingGoesWrongCallingSqrt() throws Exception {
		
		when(engine.parseAndEval(anyString())).thenThrow(new RuntimeException("Something goes wrong..."));
		
		service.sqrt(4d);
	}
	
	@Test
	public void testReturnResultWhenCallingSqrt() throws Exception {
		REXP expectedResult = new REXPDouble(2d);
		when(engine.parseAndEval(anyString())).thenReturn(expectedResult);
		
		double result = service.sqrt(4d);
		
		assertThat(result).isEqualTo(2d);
	}
	
	@Test(expected=UnsupportedOperationException.class)
	public void ksTestIsNotImplementedYet() {
		
		service.ksTest(mock(REXPDouble.class), mock(REXPDouble.class));
	}
	
	@Test(expected=UnsupportedOperationException.class)
    public void blockGeneralFunctionIsNotImplementedYet() {
        
        service.blockGeneralFunction(mock(REXPInteger.class), newList(), newList());