Author: bleny Date: 2014-02-28 16:04:53 +0100 (Fri, 28 Feb 2014) New Revision: 1698 Url: http://codelutin.com/projects/wao/repository/revisions/1698 Log: reimport test for ObsMerObsVenteSamplingPlanImportExportModel Added: trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/csv/ trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/csv/ObsMerObsVenteSamplingPlanImportExportModelTest.java Modified: trunk/wao-services/pom.xml Modified: trunk/wao-services/pom.xml =================================================================== --- trunk/wao-services/pom.xml 2014-02-28 14:54:40 UTC (rev 1697) +++ trunk/wao-services/pom.xml 2014-02-28 15:04:53 UTC (rev 1698) @@ -112,6 +112,11 @@ <artifactId>xwork-core</artifactId> </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + </dependency> + </dependencies> <build> Copied: trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/csv/ObsMerObsVenteSamplingPlanImportExportModelTest.java (from rev 1697, tags/wao-3.4.1/wao-business/src/test/java/fr/ifremer/wao/io/csv2/models/ObsMerObsVenteSamplingPlanImportExportModelTest.java) =================================================================== --- trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/csv/ObsMerObsVenteSamplingPlanImportExportModelTest.java (rev 0) +++ trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/csv/ObsMerObsVenteSamplingPlanImportExportModelTest.java 2014-02-28 15:04:53 UTC (rev 1698) @@ -0,0 +1,62 @@ +/* + * #%L + * Wao :: Business + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2012 Ifremer + * %% + * 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 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/>. + * #L% + */ +package fr.ifremer.wao.services.service.csv; + +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; +import org.nuiton.util.DateUtil; +import org.nuiton.util.PeriodDates; + +import java.util.Arrays; +import java.util.List; + +public class ObsMerObsVenteSamplingPlanImportExportModelTest { + + /** + * Vérifie la bonne détection de la période de temps (en mois) écrite + * dans les entêtes. + */ + @Test + public void testFindMinMaxMonth() { + + List<String> headers = Arrays.asList("A", "B", "C", "03/2011", + "04/2011", "05/2011", "06/2011", "D", "E", "F"); + + ObsMerObsVenteSamplingPlanImportExportModel mock = + Mockito.mock(ObsMerObsVenteSamplingPlanImportExportModel.class); + Mockito.when(mock.findMinMaxMonth(headers)).thenCallRealMethod(); + + PeriodDates actualPeriodDates = mock.findMinMaxMonth(headers); + PeriodDates expectedPeriodDates = new PeriodDates(DateUtil.createDate(1, 3, 2011), DateUtil.createDate(1, 6, 2011)); + + Assert.assertEquals( + expectedPeriodDates.getFromDate(), + actualPeriodDates.getFromDate()); + Assert.assertEquals( + expectedPeriodDates.getThruDate(), + actualPeriodDates.getThruDate()); + } + +} Property changes on: trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/csv/ObsMerObsVenteSamplingPlanImportExportModelTest.java ___________________________________________________________________ Added: svn:mergeinfo + /branches/wao-1.5.x/wao-business/src/test/java/fr/ifremer/wao/io/csv2/models/ObsMerObsVenteSamplingPlanImportExportModelTest.java:679-733