Re: [Nuiton-utils-devel] [Nuiton-utils-commits] r2154 - trunk/nuiton-utils/src/test/java/org/nuiton/util
On Tue, 19 Jul 2011 18:46:06 +0200 (CEST) bleny@users.nuiton.org wrote: Mais heu, Brendan c'est dommage d'enlever tant de tests :( En plus tu enlèves aussi du coup beaucoup de logc qui nous servent à savoir où en sont les tests vides...
Author: bleny Date: 2011-07-19 18:46:06 +0200 (Tue, 19 Jul 2011) New Revision: 2154
Url: http://nuiton.org/repositories/revision/nuiton-utils/2154
Log: removing junk code ; adding a regression test for PeriodDates (issue #1634)
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/PeriodDatesTest.java
Modified: trunk/nuiton-utils/src/test/java/org/nuiton/util/PeriodDatesTest.java =================================================================== --- trunk/nuiton-utils/src/test/java/org/nuiton/util/PeriodDatesTest.java 2011-07-17 12:11:05 UTC (rev 2153) +++ trunk/nuiton-utils/src/test/java/org/nuiton/util/PeriodDatesTest.java 2011-07-19 16:46:06 UTC (rev 2154) @@ -32,6 +32,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import java.text.DateFormat; @@ -39,6 +40,7 @@ import java.util.Date; import java.util.GregorianCalendar; import java.util.List; +import java.util.concurrent.TimeUnit;
/** @author fdesbois */ public class PeriodDatesTest { @@ -46,46 +48,9 @@ /** Logger */ private static final Log log = LogFactory.getLog(PeriodDatesTest.class); - - @BeforeClass - public static void setUpClass() throws Exception { - } - - @AfterClass - public static void tearDownClass() throws Exception { - } - - @Before - public void setUp() { - } - - @After - public void tearDown() { - } - - /** Test of createMonthsPeriodFromToday method, of class PeriodDates. */ - //@Test - public void testCreateMonthsPeriodFromToday() { - log.info("createMonthsPeriodFromToday"); - } - - /** Test of getPattern method, of class PeriodDates. */ - //@Test - public void testGetPattern() { - log.info("getPattern"); - } - - /** Test of setPattern method, of class PeriodDates. */ - //@Test - public void testSetPattern() { - log.info("setPattern"); - } - /** Test of initDayOfMonthExtremities method, of class PeriodDates. */ @Test public void testInitDayOfMonthExtremities() { - log.info("initDayOfMonthExtremities"); - PeriodDates period = new PeriodDates(); period.setFromDate(DateUtil.createDate(9,8,7,23,12,2010)); period.setThruDate(DateUtil.createDate(6,5,4,26,12,2010)); @@ -101,41 +66,9 @@ Assert.assertEquals(lastDayOf2010.getTime(), period.getThruDate()); }
- /** Test of setFromDate method, of class PeriodDates. */ - //@Test - public void testSetFromDate() { - log.info("setFromDate"); - } - - /** Test of getFromDate method, of class PeriodDates. */ - //@Test - public void testGetFromDate() { - log.info("getFromDate"); - } - - /** Test of getFromMonth method, of class PeriodDates. */ - //@Test - public void testGetFromMonth() { - log.info("getFromMonth"); - } - - /** Test of setThruDate method, of class PeriodDates. */ - //@Test - public void testSetThruDate() { - log.info("setThruDate"); - } - - /** Test of getThruDate method, of class PeriodDates. */ - //@Test - public void testGetThruDate() { - log.info("getThruDate"); - } - /** Test of getMonths method, of class PeriodDates. */ @Test public void testGetMonths() { - log.info("getMonths"); - // Prepare two calendars with time not equals to 0 Calendar cal1 = DateUtil.getDefaultCalendar(new Date()); cal1.set(Calendar.DAY_OF_MONTH, 3); @@ -167,64 +100,26 @@ } }
- /** Test of getFormatedMonths method, of class PeriodDates. */ - //@Test - public void testGetFormatedMonths() { - log.info("getFormatedMonths"); - } + @Ignore("to be done as described in issue #1634") + @Test(timeout = 60 * 1000) + public void whatIfPeriodDatesIsNotInChronologicalOrder() { + Date january = DateUtil.createDate(1, 1, 2011); + Date december = DateUtil.createDate(1, 12, 2011);
- /** Test of beforeEnd method, of class PeriodDates. */ - //@Test - public void testBeforeEnd_Calendar() { - log.info("beforeEnd"); - } + // trying to break PeriodDates by creating an anti-chronological period + try { + PeriodDates periodDates = new PeriodDates(december, january); + Assert.fail(); + } catch (IllegalArgumentException e) { + // as expected + }
- /** Test of afterEnd method, of class PeriodDates. */ - //@Test - public void testAfterEnd_Calendar() { - log.info("afterEnd"); + // got ya! + PeriodDates periodDates = new PeriodDates(); + periodDates.setFromDate(december); + periodDates.setThruDate(january); + periodDates.getMonths(); // infinite loop ! }
- /** Test of afterBegin method, of class PeriodDates. */ - //@Test - public void testAfterBegin_Calendar() { - log.info("afterBegin"); - }
- /** Test of between method, of class PeriodDates. */ - //@Test - public void testBetween_Calendar() { - log.info("between"); - } - - /** Test of beforeEnd method, of class PeriodDates. */ - //@Test - public void testBeforeEnd_Date() { - log.info("beforeEnd"); - } - - /** Test of afterEnd method, of class PeriodDates. */ - //@Test - public void testAfterEnd_Date() { - log.info("afterEnd"); - } - - /** Test of afterBegin method, of class PeriodDates. */ - //@Test - public void testAfterBegin_Date() { - log.info("afterBegin"); - } - - /** Test of between method, of class PeriodDates. */ - //@Test - public void testBetween_Date() { - log.info("between"); - } - - /** Test of toString method, of class PeriodDates. */ - //@Test - public void testToString() { - log.info("toString"); - } - }
_______________________________________________ Nuiton-utils-commits mailing list Nuiton-utils-commits@list.nuiton.org http://list.nuiton.org/cgi-bin/mailman/listinfo/nuiton-utils-commits
-- Tony Chemit -------------------- tél: +33 (0) 2 40 50 29 28 email: chemit@codelutin.com http://www.codelutin.com
participants (1)
-
Tony Chemit