Skip to content

Commit

Permalink
Improved test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Dec 18, 2018
1 parent 7d2b730 commit d257fbe
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/test/groovy/net/fortuna/ical4j/model/RecurSpec.groovy
Expand Up @@ -149,6 +149,7 @@ class RecurSpec extends Specification {
'20160331',
'20160930',
'20161031']
// 'FREQ=WEEKLY;UNTIL=20190225;INTERVAL=2;BYDAY=MO' | Value.DATE | '20181216' | '20190225' | ['20181217', '20181231', '20190114', '20190128', '20190211', '20190225']
}

@Unroll
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/net/fortuna/ical4j/model/ComponentTest.java
Expand Up @@ -162,7 +162,7 @@ public void validate(boolean recurse) throws ValidationException {
// 10am-12pm for 7 days..
component.getProperties().add(new DtStart("20080601T100000Z"));
component.getProperties().add(new DtEnd("20080601T120000Z"));
Recur recur = new Recur(Recur.DAILY, 7);
Recur recur = new Recur.Builder().frequency(Recur.Frequency.DAILY).count(7).build();
component.getProperties().add(new RRule(recur));
PeriodList expectedPeriods = new PeriodList();
expectedPeriods.add(new Period("20080601T100000Z/PT2H"));
Expand All @@ -182,7 +182,7 @@ public void validate(boolean recurse) throws ValidationException {
// weekly for 5 instances using DATE format and due date.
component.getProperties().add(new DtStart(new Date("20080601")));
component.getProperties().add(new Due(new Date("20080602")));
recur = new Recur(Recur.WEEKLY, 5);
recur = new Recur.Builder().frequency(Recur.Frequency.WEEKLY).count(5).build();
component.getProperties().add(new RRule(recur));
expectedPeriods = new PeriodList();
expectedPeriods.add(new Period("20080601T000000Z/P1D"));
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/net/fortuna/ical4j/model/RecurTest.java
Expand Up @@ -544,6 +544,7 @@ public static TestSuite suite() throws ParseException {
log.debug(recur.toString());

Calendar cal = Calendar.getInstance();
cal.set(2018, 12, 16);
Date start = new Date(cal.getTime().getTime());
cal.add(Calendar.DAY_OF_WEEK_IN_MONTH, 10);
Date end = new Date(cal.getTime().getTime());
Expand Down Expand Up @@ -622,9 +623,8 @@ public static TestSuite suite() throws ParseException {
* ==> (1997 9:00 AM EDT)September 2,4,9,11,16,18,23,25,30;October 2
* </pre>
*/
recur = new Recur(Recur.WEEKLY, 10);
recur.getDayList().add(TU);
recur.getDayList().add(TH);
recur = new Recur.Builder().frequency(Frequency.WEEKLY).count(10)
.dayList(new WeekDayList(TU, TH)).build();
log.debug(recur.toString());

cal = Calendar.getInstance();
Expand Down
Expand Up @@ -232,11 +232,9 @@ public final void testVFreeBusyComponentList3() throws Exception {
components.add(event);

// add recurrence..
Recur recur = new Recur(Recur.YEARLY, 20);
recur.getMonthList().add(new Integer(1));
recur.getMonthDayList().add(new Integer(26));
recur.getHourList().add(new Integer(9));
recur.getMinuteList().add(new Integer(30));
Recur recur = new Recur.Builder().frequency(Recur.Frequency.YEARLY).count(20)
.monthList(new NumberList("1")).monthDayList(new NumberList("26"))
.hourList(new NumberList("9")).minuteList(new NumberList("30")).build();
event.getProperties().add(new RRule(recur));

if (log.isDebugEnabled()) {
Expand Down
Expand Up @@ -31,12 +31,12 @@
*/
package net.fortuna.ical4j.model.property;

import java.text.ParseException;

import junit.framework.TestSuite;
import net.fortuna.ical4j.model.PropertyTest;
import net.fortuna.ical4j.model.Recur;

import java.text.ParseException;

/**
* Created: [24/11/2008]
*
Expand Down Expand Up @@ -66,7 +66,7 @@ public ExRuleTest(String testMethod, ExRule property) {
*/
public static TestSuite suite() {
TestSuite suite = new TestSuite();
ExRule rule = new ExRule(new Recur(Recur.DAILY, 1));
ExRule rule = new ExRule(new Recur.Builder().frequency(Recur.Frequency.DAILY).count(1).build());
suite.addTest(new ExRuleTest(rule, "FREQ=DAILY;COUNT=1"));
suite.addTest(new ExRuleTest("testValidation", rule));
suite.addTest(new ExRuleTest("testEquals", rule));
Expand Down
Expand Up @@ -31,12 +31,12 @@
*/
package net.fortuna.ical4j.model.property;

import java.text.ParseException;

import junit.framework.TestSuite;
import net.fortuna.ical4j.model.PropertyTest;
import net.fortuna.ical4j.model.Recur;

import java.text.ParseException;

/**
* $Id$
*
Expand Down Expand Up @@ -68,7 +68,7 @@ public RRuleTest(String testMethod, RRule property) {
*/
public static TestSuite suite() {
TestSuite suite = new TestSuite();
RRule rule = new RRule(new Recur(Recur.WEEKLY, 3));
RRule rule = new RRule(new Recur.Builder().frequency(Recur.Frequency.WEEKLY).count(3).build());
suite.addTest(new RRuleTest(rule, "FREQ=WEEKLY;COUNT=3"));
suite.addTest(new RRuleTest("testValidation", rule));
suite.addTest(new RRuleTest("testEquals", rule));
Expand Down

0 comments on commit d257fbe

Please sign in to comment.