Examples of RandomFunction


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

  }

  @Test
  public void randomBigIntegerRangeTest() {
      BigInteger start = new BigInteger("2147483648"), end = new BigInteger("2147483650");
      BigInteger value = new RandomFunction(BigInteger.class, new Range(start, end)).generateValue();
      assertNotNull("Generated BigInteger can not be null", value);
      assertTrue("Generated BigInteger does not exist in the range", (start.compareTo(value) <= 0 && value.compareTo(end) <= 0));
  }
View Full Code Here

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

  }

  @Test
  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.RandomFunction

  }

  @Test(expected = IllegalArgumentException.class)
  public void randomLongRangeIncorrectTest() {
    Long start = 80L, end = 80L;
    new RandomFunction(Long.class, new Range(start, end)).generateValue();
  }
View Full Code Here

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

  }

  @Test(expected = IllegalArgumentException.class)
  public void randomDoubleRangeIncorrectTest() {
    Double start = 80.0, end = 80.0;
    new RandomFunction(Long.class, new Range(start, end)).generateValue();
  }
View Full Code Here

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

  }
 
  @Test
  public void randomFunction() {
    Function[] functions = {new NameFunction(), new NameFunction(Gender.MALE), new NameFunction(Gender.FEMALE)};
    Object value = new RandomFunction(functions).generateValue();
    assertNotNull("Generated value can not be null", value);
  }
View Full Code Here

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

    assertNotNull("Generated value can not be null", value);
  }
 
  @Test
  public void randomEnum() {
    Object value = new RandomFunction(Gender.class).generateValue();
    assertNotNull("Generated enum can not be null", value);
    assertTrue("Generated value is not a Enum", value instanceof Enum);
  }
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.