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; 019 020import static de.cuioss.test.generator.Generators.integers; 021 022/** 023 * Generates complete German street addresses by combining street names from {@link StreetNameGenerator} 024 * with random house numbers. 025 * 026 * <p>The generator creates addresses in the format: "streetname housenumber"</p> 027 * <ul> 028 * <li>Street names are typical German street names (e.g., "Hauptstraße", "Bahnhofstraße")</li> 029 * <li>House numbers range from 1 to 111</li> 030 * </ul> 031 * 032 * <p><em>Example usage:</em></p> 033 * <pre> 034 * var generator = new StreetGenerator(); 035 * String address = generator.next(); // e.g. "Hauptstraße 42" 036 * </pre> 037 * 038 * @author Oliver Wolff 039 * @see StreetNameGenerator 040 */ 041public class StreetGenerator implements TypedGenerator<String> { 042 043 private final TypedGenerator<String> streets = new StreetNameGenerator(); 044 private final TypedGenerator<Integer> number = integers(1, 111); 045 046 @Override 047 public String next() { 048 return streets.next() + " " + number.next(); 049 } 050 051 @Override 052 public Class<String> getType() { 053 return String.class; 054 } 055}