Examples of generateValue()


Examples of br.com.six2six.fixturefactory.function.AtomicFunction.generateValue()

  @Override
  public <T> T generateValue() {
    List<T> results = new ArrayList<T>();
    AtomicFunction function = new RandomFunction(clazz);
    for (int i = 0; i < quantity; i++) {
      results.add((T) function.generateValue());
    }
   
    return (T) results;
  }
}
View Full Code Here

Examples of br.com.six2six.fixturefactory.function.impl.ChronicFunction.generateValue()

public class ChronicFunctionTest {
   
    @Test
    public void testChronic() {
        ChronicFunction chronicFunction = new ChronicFunction("yesterday", new Options(Time.construct(2011, 10, 31, 14, 0, 0, 0)));
        Assert.assertEquals(Time.construct(2011, 10, 30, 12).getTime(), ((Calendar) chronicFunction.generateValue()).getTime());
    }

}
View Full Code Here

Examples of br.com.six2six.fixturefactory.function.impl.DateAsStringFunction.generateValue()

   
    DateFunction dateFunction = mock(DateFunction.class);
    when(dateFunction.generateValue()).thenReturn(date);
    DateAsStringFunction dateAsStringFunction = new DateAsStringFunction(dateFunction, pattern);
   
    assertEquals(dateString, dateAsStringFunction.generateValue());
  }

}
View Full Code Here

Examples of br.com.six2six.fixturefactory.function.impl.RandomFunction.generateValue()

  public void randomLongDistributionTest() {
      Long start = 85L, end = 86L;
        RandomFunction randomFunction = new RandomFunction(Long.class, new Range(start, end));
        Set<Long> values = new HashSet<Long>();
        for (int i=0; i<10; i++) {
            values.add((Long) randomFunction.generateValue());
        }
        assertTrue("Generated at least one equal to start", values.contains(start));
        assertTrue("Generated at least one equal to end", values.contains(end));
  }
View Full Code Here

Examples of br.com.six2six.fixturefactory.function.impl.RandomFunction.generateValue()

  public void randomDoubleRangeTest() {
      Double start = 85.1, end = 85.2;
      RandomFunction randomFunction = new RandomFunction(Double.class, new Range(start, end));
        for (int i=0; i<10; i++) {
            Object value = randomFunction.generateValue();
            assertNotNull("Generated double can not be null", value);
            assertTrue("Generated double does not exist in the range", (start <= (Double) value && (Double) value <= end));
        }
  }
View Full Code Here

Examples of br.com.six2six.fixturefactory.function.impl.RandomFunction.generateValue()

  public void randomBigIntegerDistributionTest() {
      BigInteger start = new BigInteger("2147483648"), end = new BigInteger("2147483649");
      RandomFunction randomFunction = new RandomFunction(BigInteger.class, new Range(start, end));
      Set<BigInteger> values = new HashSet<BigInteger>();
      for (int i=0; i<10; i++) {
          values.add((BigInteger) randomFunction.generateValue());
      }
      assertTrue("Generated at least one equal to start", values.contains(start));
      assertTrue("Generated at least one equal to end", values.contains(end));
  }
View Full Code Here

Examples of br.com.six2six.fixturefactory.function.impl.SequenceFunction.generateValue()

  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

Examples of br.com.six2six.fixturefactory.function.impl.SequenceFunction.generateValue()

  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

Examples of br.com.six2six.fixturefactory.function.impl.SequenceFunction.generateValue()

  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

Examples of br.com.six2six.fixturefactory.function.impl.SequenceFunction.generateValue()

  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
TOP
Copyright © 2018 www.massapi.com. 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.