@Test public void resolves_integers() { Integer result = (Integer)this.generator.create(Integer.class, null); assertTrue(result > 0 && result < 127); }
@Override public Object create(Object request, SpecimenContext context) { if (request.equals(Byte.class)) { return (byte) getNextRandom(); } else if (request.equals(Short.class)) { return (short) getNextRandom(); } else if (request.equals(Integer.class)) { return (int) getNextRandom(); } else if (request.equals(Long.class)) { return getNextRandom(); } else if (request.equals(Float.class)) { return (float) getNextRandom(); } else if (request.equals(Double.class)) { return (double) getNextRandom(); } else if (request.equals(BigDecimal.class)) { return BigDecimal.valueOf(getNextRandom()); } else if (request.equals(BigInteger.class)) { return BigInteger.valueOf(getNextRandom()); } return new NoSpecimen(); }
NumberInRangeGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (request.equals(Byte.class)) { return (byte) getNextRandom(); } else if (request.equals(Short.class)) { return (short) getNextRandom(); } else if (request.equals(Integer.class)) { return (int) getNextRandom(); } else if (request.equals(Long.class)) { return getNextRandom(); } else if (request.equals(Float.class)) { return (float) getNextRandom(); } else if (request.equals(Double.class)) { return (double) getNextRandom(); } else if (request.equals(BigDecimal.class)) { return BigDecimal.valueOf(getNextRandom()); } else if (request.equals(BigInteger.class)) { return BigInteger.valueOf(getNextRandom()); } return new NoSpecimen(); } }
NumberInRangeGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (request.equals(Byte.class)) { return (byte) getNextRandom(); } else if (request.equals(Short.class)) { return (short) getNextRandom(); } else if (request.equals(Integer.class)) { return (int) getNextRandom(); } else if (request.equals(Long.class)) { return getNextRandom(); } else if (request.equals(Float.class)) { return (float) getNextRandom(); } else if (request.equals(Double.class)) { return (double) getNextRandom(); } else if (request.equals(BigDecimal.class)) { return BigDecimal.valueOf(getNextRandom()); } else if (request.equals(BigInteger.class)) { return BigInteger.valueOf(getNextRandom()); } return new NoSpecimen(); } NumberInRangeGenerator();  NumberInRangeGenerator(long... limits); }
NumberInRangeGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (request.equals(Byte.class)) { return (byte) getNextRandom(); } else if (request.equals(Short.class)) { return (short) getNextRandom(); } else if (request.equals(Integer.class)) { return (int) getNextRandom(); } else if (request.equals(Long.class)) { return getNextRandom(); } else if (request.equals(Float.class)) { return (float) getNextRandom(); } else if (request.equals(Double.class)) { return (double) getNextRandom(); } else if (request.equals(BigDecimal.class)) { return BigDecimal.valueOf(getNextRandom()); } else if (request.equals(BigInteger.class)) { return BigInteger.valueOf(getNextRandom()); } return new NoSpecimen(); } NumberInRangeGenerator();  NumberInRangeGenerator(long... limits); @Override Object create(Object request, SpecimenContext context); }
NumberInRangeGenerator implements SpecimenBuilder { @Override public Object create(Object request, SpecimenContext context) { if (request.equals(Byte.class)) { return (byte) getNextRandom(); } else if (request.equals(Short.class)) { return (short) getNextRandom(); } else if (request.equals(Integer.class)) { return (int) getNextRandom(); } else if (request.equals(Long.class)) { return getNextRandom(); } else if (request.equals(Float.class)) { return (float) getNextRandom(); } else if (request.equals(Double.class)) { return (double) getNextRandom(); } else if (request.equals(BigDecimal.class)) { return BigDecimal.valueOf(getNextRandom()); } else if (request.equals(BigInteger.class)) { return BigInteger.valueOf(getNextRandom()); } return new NoSpecimen(); } NumberInRangeGenerator();  NumberInRangeGenerator(long... limits); @Override Object create(Object request, SpecimenContext context);  }