com.github.javafaker.Name Java Examples

The following examples show how to use com.github.javafaker.Name. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataGenerator.java    From kafka-streams-in-action with Apache License 2.0 5 votes vote down vote up
/**
 * Special method for generating customers with static customer ID's so
 * we can easily run interactive queries with a predictable list of names
 * @return customer list
 */
public static List<Customer> generateCustomersForInteractiveQueries() {
    List<Customer> customers = new ArrayList<>(10);
    List<String> customerIds = Arrays.asList("12345678", "222333444", "33311111", "55556666", "4488990011", "77777799", "111188886","98765432", "665552228", "660309116");
    Faker faker = new Faker();
    List<String> creditCards = generateCreditCardNumbers(10);
    for (int i = 0; i < 10; i++) {
        Name name = faker.name();
        String creditCard = creditCards.get(i);
        String customerId = customerIds.get(i);
        customers.add(new Customer(name.firstName(), name.lastName(), customerId, creditCard));
    }
    return customers;
}
 
Example #2
Source File: DataGenerator.java    From kafka-streams-in-action with Apache License 2.0 5 votes vote down vote up
public static List<Customer> generateCustomers(int numberCustomers) {
    List<Customer> customers = new ArrayList<>(numberCustomers);
    Faker faker = new Faker();
    List<String> creditCards = generateCreditCardNumbers(numberCustomers);
    for (int i = 0; i < numberCustomers; i++) {
        Name name = faker.name();
        String creditCard = creditCards.get(i);
        String customerId = faker.idNumber().valid();
        customers.add(new Customer(name.firstName(), name.lastName(), customerId, creditCard));
    }
    return customers;
}
 
Example #3
Source File: WanServer.java    From spring-data-examples with Apache License 2.0 5 votes vote down vote up
private void createCustomers(CustomerRepository repository) {
	Faker faker = new Faker();
	Name fakerName = faker.name();
	Internet fakerInternet = faker.internet();
	LongStream.range(0, 300).forEach(index -> repository.save(new Customer(index,
			new EmailAddress(fakerInternet.emailAddress()), fakerName.firstName(), fakerName.lastName())));
}
 
Example #4
Source File: EstatioFakeDataService.java    From estatio with Apache License 2.0 4 votes vote down vote up
@Programmatic
public Name name() {
    return faker.name();
}