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

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


    assertTrue("Generated value is not a Float", value instanceof Float);
  }

  @Test
  public void randomDoubleTest() {
    Object value = new RandomFunction(Double.class).generateValue();
    assertNotNull("Generated double can not be null", value);
    assertTrue("Generated value is not a Double", value instanceof Double);
  }
View Full Code Here


    assertTrue("Generated value is not a Double", value instanceof Double);
  }

  @Test
  public void randomBigDecimalTest() {
      Object value = new RandomFunction(BigDecimal.class).generateValue();
      assertNotNull("Generated BigDecimal must not be null", value);
      assertTrue("Generated value is not a BigDecimal", value instanceof BigDecimal);
  }
View Full Code Here

      assertTrue("Generated value is not a BigDecimal", value instanceof BigDecimal);
  }
 
  @Test
  public void randomBigDecimalWithMathContextTest() {
      Object value = new RandomFunction(BigDecimal.class, new MathContext(3, RoundingMode.HALF_EVEN)).generateValue();
      assertNotNull("Generated BigDecimal must not be null", value);
      assertTrue("Generated value is not a BigDecimal", value instanceof BigDecimal);
      assertTrue("Generated value should have a precision of 3", ((BigDecimal) value).precision() == 3);
  }
View Full Code Here

      assertTrue("Generated value should have a precision of 3", ((BigDecimal) value).precision() == 3);
  }

  @Test
  public void randomBigIntegerTest() {
      Object value = new RandomFunction(BigInteger.class).generateValue();
      assertNotNull("Generated BigInteger must not be null", value);
      assertTrue("Generated value is not a BigInteger", value instanceof BigInteger);
  }
View Full Code Here

      assertTrue("Generated value is not a BigInteger", value instanceof BigInteger);
  }

  @Test
  public void randomBooleanTest() {
    Object value = new RandomFunction(Boolean.class).generateValue();
    assertNotNull("Generated boolean can not be null", value);
    assertTrue("Generated value is not a Boolean", value instanceof Boolean);
  }
View Full Code Here

  }
 
  @Test
  public void randomDatasetTest() {
    String[] names = {"Anderson", "Arthur", "Douglas"};
    Object value = new RandomFunction(names).generateValue();
    assertNotNull("Generated name can not be null", value);
    assertTrue("Generated name does not exist in the dataset names", Arrays.asList(names).contains(value));
  }
View Full Code Here

  }

  @Test
  public void randomByteRangeTest() {
      Byte start = 1, end = 100;
      Byte value = new RandomFunction(Byte.class, new Range(start, end)).generateValue();
      assertNotNull("Generated byte must not be null", value);
      assertTrue("Generated byte does not exist in the range", (start <= value && value <= end));
  }
View Full Code Here

  }

  @Test
  public void randomShortRangeTest() {
      Short start = 1, end = 100;
      Short value = new RandomFunction(Short.class, new Range(start, end)).generateValue();
      assertNotNull("Generated short must not be null", value);
      assertTrue("Generated short does not exist in the range", (start <= value && value <= end));
  }
View Full Code Here

  }

  @Test
  public void randomLongRangeTest() {
    Long start = 85L, end = 86L;
        Object value = new RandomFunction(Long.class, new Range(start, end)).generateValue();
    assertNotNull("Generated long can not be null", value);
    assertTrue("Generated long does not exist in the range", (start <= (Long) value && (Long) value <= end));
  }
View Full Code Here

  }

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

TOP

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

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.