Package de.cuioss.test.generator.impl
Class URLGenerator
java.lang.Object
de.cuioss.test.generator.impl.URLGenerator
- All Implemented Interfaces:
TypedGenerator<URL>
Generates valid
URL instances from a predefined set of well-known websites.
URL characteristics:
- All URLs are valid and accessible
- Mix of HTTP and HTTPS protocols
- Includes popular tech, development, and reference sites
Available domains include:
- Development: github.com, gitlab.com, sonarcloud.io
- Technology: heise.de, stackoverflow.com
- Reference: wikipedia.org, mozilla.org
- Corporate: microsoft.com, apple.com, x-tention.com
Example usage:
var generator = new URLGenerator(); URL url = generator.next(); // Returns a random URL from the predefined set
Note: While the generator ensures syntactically correct URLs, it does not guarantee that the URLs are currently reachable.
- Author:
- Oliver Wolff
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
URLGenerator
public URLGenerator()
-
-
Method Details
-
next
Description copied from interface:TypedGeneratorGenerates the next instance based on the generator's configuration. Implementations must ensure thread-safety.- Specified by:
nextin interfaceTypedGenerator<URL>- Returns:
- A newly created instance. May be null if the generator explicitly supports null value generation.
-
getType
Description copied from interface:TypedGeneratorProvides type information about what kind of objects this generator creates. The default implementation uses the first non-null result fromTypedGenerator.next()to determine the type.Note: If your generator may return null values or the generated type differs from the actual instance type, you should override this method.
- Specified by:
getTypein interfaceTypedGenerator<URL>- Returns:
- The class information indicating which type this generator is responsible for.
-