001package de.cuioss.test.generator.impl; 002 003import java.net.MalformedURLException; 004import java.net.URL; 005 006import de.cuioss.test.generator.Generators; 007import de.cuioss.test.generator.TypedGenerator; 008 009/** 010 * {@link TypedGenerator} for generating basic {@link URL}s 011 * 012 * @author Oliver Wolff 013 */ 014public class URLGenerator implements TypedGenerator<URL> { 015 016 private static final TypedGenerator<String> generator = 017 Generators.fixedValues(String.class, "https://www.heise.de", "https://stackoverflow.com", 018 "https://github.com/cuioss", "https://www.gitlab.com", "https://sonarcloud.io", 019 "https://www.eclipse.org", "https://www.sesamestreet.org/", "https://de.wikipedia.org", 020 "https://www.xing.com", "https://www.mozilla.org", "https://avm.de/", "https://www.primefaces.org/", 021 "http://getbootstrap.com", "https://x-tention.com", "https://www.microsoft.com", 022 "https://www.apple.com", "https://www.android.com"); 023 024 @Override 025 public URL next() { 026 try { 027 return new URL(generator.next()); 028 } catch (final MalformedURLException e) { 029 throw new IllegalStateException(e); 030 } 031 } 032 033 @Override 034 public Class<URL> getType() { 035 return URL.class; 036 } 037 038}