001/* 002 * Copyright 2023 the original author or authors. 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package de.cuioss.test.generator.domain; 017 018import static de.cuioss.test.generator.Generators.fixedValues; 019import static de.cuioss.test.generator.Generators.strings; 020 021import de.cuioss.test.generator.TypedGenerator; 022import lombok.AccessLevel; 023import lombok.RequiredArgsConstructor; 024 025/** 026 * Combines different variants of Generators for firstnames. The generators 027 * {@link #FIRSTNAMES_MALE_GERMAN}, {@link #FIRSTNAMES_FEMALE_GERMAN} and 028 * {@link #FIRSTNAMES_ANY_GERMAN} are for visual mocks, {@link #UNIT_TESTS} for 029 * unit-tests. 030 * 031 * @author Oliver Wolff 032 */ 033@RequiredArgsConstructor(access = AccessLevel.PRIVATE) 034public enum NameGenerators { 035 036 // German 037 /** Top 10 male name in Germany 2014 */ 038 FIRSTNAMES_MALE_GERMAN(fixedValues(NameLibrary.FIRSTNAMES_MALE_GERMAN)), 039 040 /** Top 10 female name in Germany 2014 */ 041 FIRSTNAMES_FEMALE_GERMAN(fixedValues(NameLibrary.FIRSTNAMES_FEMALE_GERMAN)), 042 043 /** 044 * The intersection of {@link #FIRSTNAMES_MALE_GERMAN} and 045 * {@link #FIRSTNAMES_FEMALE_GERMAN} names 046 */ 047 FIRSTNAMES_ANY_GERMAN(fixedValues(NameLibrary.FIRSTNAMES_ANY_GERMAN)), 048 049 /** Top 10 names in Wikipedia */ 050 FAMILY_NAMES_GERMAN(fixedValues(NameLibrary.LAST_NAMES_GERMAN)), 051 052 // English 053 /** Top 10 male name in US 2014 */ 054 FIRSTNAMES_MALE_ENGLISH(fixedValues(NameLibrary.FIRSTNAMES_MALE_ENGLISH)), 055 056 /** Top 10 female name in US 2014 */ 057 FIRSTNAMES_FEMALE_ENGLISH(fixedValues(NameLibrary.FIRSTNAMES_FEMALE_ENGLISH)), 058 059 /** 060 * The intersection of {@link #FIRSTNAMES_MALE_ENGLISH} and 061 * {@link #FIRSTNAMES_FEMALE_ENGLISH} names 062 */ 063 FIRSTNAMES_ANY_ENGLISH(fixedValues(NameLibrary.FIRSTNAMES_ANY_ENGLISH)), 064 065 /** Top 10 names from U.S. Census Bureau */ 066 FAMILY_NAMES_ENGLISH(fixedValues(NameLibrary.LAST_NAMES_ENGLISH)), 067 068 /** Technical String for unit-testing. Min size is 1, max size 256 */ 069 UNIT_TESTS(strings(1, 256)); 070 071 private final TypedGenerator<String> generator; 072 073 /** 074 * @return the concrete generator. 075 */ 076 public TypedGenerator<String> generator() { 077 return generator; 078 } 079 080}