Package br.com.six2six.fixturefactory.function.impl

Examples of br.com.six2six.fixturefactory.function.impl.SequenceFunction


  public Range range(Number start, Number end) {
    return new Range(start, end);
  }

  public Function sequence(Sequence<?> sequence) {
    return new SequenceFunction(sequence);
  }
View Full Code Here


  public Function sequence(Sequence<?> sequence) {
    return new SequenceFunction(sequence);
  }

  public Function sequence(Number startWith, int incrementBy) {
    return new SequenceFunction(new NumberSequence(startWith, incrementBy));
  }
View Full Code Here

    return new SequenceFunction(new NumberSequence(startWith, incrementBy));
  }
 
  public Function sequence(Class<? extends Number> clazz) {
    Number number = ReflectionUtils.newInstance(clazz, Arrays.asList("1"));
    return new SequenceFunction(new NumberSequence(number, 1));
  }
View Full Code Here

  public Function sequenceDate(String base, CalendarInterval interval) {
    return this.sequenceDate(base, new SimpleDateFormat("yyyy-MM-dd"), interval);
  }
 
  public Function sequenceDate(String base, DateFormat simpleDateFormat, CalendarInterval interval) {
    return new SequenceFunction(new CalendarSequence(toCalendar(base, simpleDateFormat), interval));
  }
View Full Code Here

public class CalendarSequenceFunctionTest {

  @Test
  public void addOneDay() {
    Calendar baseCalendar = DateTimeUtils.toCalendar("2011-04-09", new SimpleDateFormat("yyyy-MM-dd"));
    SequenceFunction sequenceFunction = new SequenceFunction(new CalendarSequence(baseCalendar, new CalendarInterval(1, Calendar.DAY_OF_MONTH)));
   
    for (int i=0; i<3; i++) {
      Calendar calendar = sequenceFunction.generateValue();
      assertEquals("Calendars should be equal", baseCalendar, calendar);
      baseCalendar.add(Calendar.DAY_OF_MONTH, 1);
    }
  }
View Full Code Here

  }
 
  @Test
  public void subtractOneDay() {
    Calendar baseCalendar = DateTimeUtils.toCalendar("2011-04-09", new SimpleDateFormat("yyyy-MM-dd"));
    SequenceFunction sequenceFunction = new SequenceFunction(new CalendarSequence(baseCalendar, new CalendarInterval(-1, Calendar.DAY_OF_MONTH)));
   
    for (int i=0; i<3; i++) {
      Calendar calendar = sequenceFunction.generateValue();
      assertEquals("Calendars should be equal", baseCalendar, calendar);
      baseCalendar.add(Calendar.DAY_OF_MONTH, -1);
    }
  }
View Full Code Here

  }
 
  @Test
  public void addThreeDays() {
    Calendar baseCalendar = DateTimeUtils.toCalendar("2011-04-09", new SimpleDateFormat("yyyy-MM-dd"));
    SequenceFunction sequenceFunction = new SequenceFunction(new CalendarSequence(baseCalendar, new CalendarInterval(3, Calendar.DAY_OF_MONTH)));
   
    for (int i=0; i<3; i++) {
      Calendar calendar = sequenceFunction.generateValue();
      assertEquals("Calendars should be equal", baseCalendar, calendar);
      baseCalendar.add(Calendar.DAY_OF_MONTH, 3);
    }
  }
View Full Code Here

  }
 
  @Test
  public void subtractThreeDays() {
    Calendar baseCalendar = DateTimeUtils.toCalendar("2011-04-09", new SimpleDateFormat("yyyy-MM-dd"));
    SequenceFunction sequenceFunction = new SequenceFunction(new CalendarSequence(baseCalendar, new CalendarInterval(-3, Calendar.DAY_OF_MONTH)));
   
    for (int i=0; i<3; i++) {
      Calendar calendar = sequenceFunction.generateValue();
      assertEquals("Calendars should be equal", baseCalendar, calendar);
      baseCalendar.add(Calendar.DAY_OF_MONTH, -3);
    }
  }
View Full Code Here

public class NumberSequenceFunctionTest {

  @Test
  public void intSequence() {
    SequenceFunction function = new SequenceFunction(new NumberSequence(0, 1));
   
    for (int i=0; i<3; i++) {
      assertEquals("integers should be equal", function.generateValue(), i);
    }
  }
View Full Code Here

    }
  }
 
  @Test
  public void longSequence() {
    SequenceFunction function = new SequenceFunction(new NumberSequence(1L, 2));
   
    for (int i=1; i<=5; i=i+2) {
      assertEquals("longs should be equal", function.generateValue(), (long) i);
    }
  }
View Full Code Here

TOP

Related Classes of br.com.six2six.fixturefactory.function.impl.SequenceFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.