001/* 002 * Copyright © 2025 CUI-OpenSource-Software (info@cuioss.de) 003 * 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 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 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 de.cuioss.test.generator.TypedGenerator; 019import lombok.AccessLevel; 020import lombok.RequiredArgsConstructor; 021 022import static de.cuioss.test.generator.Generators.fixedValues; 023import static de.cuioss.test.generator.Generators.strings; 024 025/** 026 * Provides generators for academic and professional titles. 027 * 028 * <p>Available generators:</p> 029 * <ul> 030 * <li>{@link #READABLE} - Common academic titles for realistic test data</li> 031 * <li>{@link #UNIT_TESTS} - Technical string generator for unit testing</li> 032 * </ul> 033 * 034 * <p><em>Example usage:</em></p> 035 * <pre> 036 * {@code TypedGenerator<String> generator = TitleGenerator.READABLE.generator();} 037 * String title = generator.next(); // Returns titles like "Dr.", "M.A.", etc. 038 * </pre> 039 * 040 * @author Oliver Wolff 041 */ 042@RequiredArgsConstructor(access = AccessLevel.PRIVATE) 043public enum TitleGenerator { 044 045 /** 046 * Common academic and professional titles. 047 * Includes: Dr., Dr. h.c., M.A., Dr. med. 048 */ 049 READABLE(fixedValues("Dr.", "Dr. h.c.", "M.A.", "Dr. med.")), 050 051 /** 052 * Technical string generator for unit testing. 053 * Generates random strings between 1 and 10 characters. 054 */ 055 UNIT_TESTS(strings(1, 10)); 056 057 private final TypedGenerator<String> generator; 058 059 /** 060 * Provides access to the underlying title generator. 061 * 062 * @return A {@link TypedGenerator} that generates titles according to the enum constant's specification 063 */ 064 public TypedGenerator<String> generator() { 065 return generator; 066 } 067}