All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.flextrade.jfixture.builders.CharacterGenerator Maven / Gradle / Ivy

Go to download

JFixture is an open source library based on the popular .NET library, AutoFixture

There is a newer version: 2.7.2
Show newest version
package com.flextrade.jfixture.builders;

import com.flextrade.jfixture.NoSpecimen;
import com.flextrade.jfixture.SpecimenBuilder;
import com.flextrade.jfixture.SpecimenContext;

import java.util.Random;

class CharacterGenerator implements SpecimenBuilder {

    private final Random random = new Random();

    @Override
    public Object create(Object request, SpecimenContext context) {

        if (!request.equals(Character.class)) {
            return new NoSpecimen();
        }

        return (char) (random.nextInt(26) + 'a');
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy