/*
 * Copyright 2010-2020 James Pether Sörling
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *	$Id$
 *  $HeadURL$
*/
package com.hack23.cia.service.external.esv.impl;

import java.io.IOException;
import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.hack23.cia.service.external.esv.api.GovernmentOperationPeriodOutcome;

/**
 * The Class EsvGovernmentOperationsExcelReaderTest.
 */
public final class EsvGovernmentOperationsExcelReaderTest extends AbstractEsvFunctionalIntegrationTest {

	/** The esv government operations excel reader. */
	@Autowired
	private EsvGovernmentOperationsExcelReader esvGovernmentOperationsExcelReader;


	/**
	 * Gets the report test.
	 *
	 * @return the report test
	 * @throws IOException
	 */
	@Test
	public void getReportTest() throws IOException {
		final List<GovernmentOperationPeriodOutcome> report = esvGovernmentOperationsExcelReader.getReport();
		assertNotNull(report);
		assertFalse(report.isEmpty());
		final GovernmentOperationPeriodOutcome outcome = report.get(0);
		assertNotNull(outcome.getVariableName());
		assertNotNull(outcome.getPeriod());
		assertTrue(outcome.getValue() >= 0.0);
		assertTrue(outcome.getPercentageChangeFromPreviousToLatest()  >= 0.0);
		assertTrue(outcome.getPercentageChangeFromSamePeriodLastYearToLatest()  >= 0.0);
		assertNotNull(outcome.getObservationStatus());
	}
}

/*
 * Copyright 2010-2020 James Pether Sörling
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *	$Id$
 *  $HeadURL$
*/
package com.hack23.cia.service.external.esv.impl;

import java.io.IOException;
import java.util.List;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import com.hack23.cia.service.external.esv.api.GovernmentOperationPeriodOutcome;

/**
 * The Class EsvGovernmentOperationsExcelReaderTest.
 */
public final class EsvGovernmentOperationsExcelReaderTest extends AbstractEsvFunctionalIntegrationTest {

	/** The esv government operations excel reader. */
	@Autowired
	private EsvGovernmentOperationsExcelReader esvGovernmentOperationsExcelReader;


	/**
	 * Gets the report test.
	 *
	 * @return the report test
	 * @throws IOException
	 */
	@Test
	public void getReportTest() throws IOException {
		final List<GovernmentOperationPeriodOutcome> report = esvGovernmentOperationsExcelReader.getReport();
		assertNotNull(report);
		assertFalse(report.isEmpty());
		final GovernmentOperationPeriodOutcome outcome = report.get(0);
		assertNotNull(outcome.getVariableName());
		assertNotNull(outcome.getPeriod());
		assertNotNull(outcome.getObservationStatus());
	}
}

test cleanup