/*******************************************************************************
 * BusinessHorizon2
 *
 * Copyright (C) 
 * 2012-2013 Christian Gahlert, Florian Stier, Kai Westerholz,
 * Timo Belz, Daniel Dengler, Katharina Huber, Christian Scherer, Julius Hacker
 * 2013-2014 Marcel Rosenberger, Mirko Göpfrich, Annika Weis, Katharina Narlock, 
 * Volker Meier
 * 
 *
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 ******************************************************************************/

package dhbw.ka.mwi.businesshorizon2.tests.methods.timeseries;

import junit.framework.TestCase;

import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

import Jama.Matrix;
import cern.colt.list.DoubleArrayList;
import cern.colt.matrix.DoubleFactory2D;
import cern.colt.matrix.DoubleMatrix2D;

import dhbw.ka.mwi.businesshorizon2.methods.StochasticMethodException;
import dhbw.ka.mwi.businesshorizon2.methods.timeseries.AnalysisTimeseries;


/**
 * Diese Klasse stellt den jUnit-Test der im Klassenname aufgeführten Methode in der Klasse AnalysisTime dar.
 * 
 * @author Volker Maier
 * 
 */

public class TestModellparameter extends TestCase {
	
	private static final Logger logger = Logger.getLogger("AnalysisTimeseries.class");
	
		
	@Test
	public void testModellparameter() {
		
		double [] cashflows = {1,5,10,20,30};
		
		double[] expectedParmas = {-1.09253751,-0.790322469, -0.651577395, -0.488155996, -0.215330237};
		
		
		AnalysisTimeseries at = new AnalysisTimeseries();
		
		//try {
			//matrixErgebnis = at.berechneModellparameter(autokovarianzVorgabe,p)  ;
			double[] parameters = at.calculateModelParameters(at.createMatrix(cashflows), at.calculateAutocorrelations(cashflows));
		//} catch (StochasticMethodException e) {
		//	logger.debug(e.getMessage());
		//}
			
			for (double d : parameters) {
				System.out.println("actualparams: "+d);
			}
			
			for (double d : expectedParmas) {
				System.out.println("expectedparams: "+d);
			}
			
			
			Assert.assertArrayEquals(expectedParmas, parameters, 0.1);
			
			
		
		}

	}

@@ -1181,42 +1181,8 @@
 s;%0A%0A
-import junit.framework.TestCase;%0A%0A
 impo
@@ -1255,251 +1255,14 @@
 nit.
-Ignore;%0Aimport org.junit.Test;%0A%0Aimport Jama.Matrix;%0Aimport cern.colt.list.DoubleArrayList;%0Aimport cern.colt.matrix.DoubleFactory2D;%0Aimport cern.colt.matrix.DoubleMatrix2D;%0A%0Aimport dhbw.ka.mwi.businesshorizon2.methods.StochasticMethodException;
+Test;%0A
 %0Aimp
@@ -1333,16 +1333,49 @@
 series;%0A
+import junit.framework.TestCase;%0A
 %0A%0A/**%0A *
@@ -1577,97 +1577,8 @@
 %7B%0A%09%0A
-%09private static final Logger logger = Logger.getLogger(%22AnalysisTimeseries.class%22);%0A%09%0A%09%09%0A
 %09@Te
@@ -1650,19 +1650,32 @@
 = %7B1
-,5,10,20,30
+002323,33256673,44,55,66
 %7D;%0A%09

update Test