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

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


  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

      add("firstName", firstName(Gender.MALE));
      add("lastName", lastName());
      add("gender", Gender.MALE);
    }});
   
    final Sequence<Number> numberSequence = new NumberSequence(1L, 1);
   
    Fixture.of(Student.class).addTemplate("sharedSequence", new Rule(){{
      add("id", sequence(numberSequence));
    }}
    ).addTemplate("otherSharedSequence", new Rule(){{
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

    }
  }
 
  @Test
  public void floatSequence() {
    SequenceFunction function = new SequenceFunction(new NumberSequence(1.2f, 1));
   
    for (int i=1; i<=3; i++) {
      assertEquals("floats should be equal", function.generateValue(), (float) i+(.2F));
    }
  }
View Full Code Here

    }
  }
 
  @Test
  public void doubleSequence() {
    SequenceFunction function = new SequenceFunction(new NumberSequence(1.23d, 2));
   
    for (int i=1; i<=5; i=i+2) {
      assertEquals("doubles should be equal", function.generateValue(), (double) i+(.23d));
    }
  }
View Full Code Here

TOP

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

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.