From d2135d8df9d7bb4a9942280ec46b437c44043c27 Mon Sep 17 00:00:00 2001 From: Maximilian Irro Date: Thu, 29 Apr 2021 19:44:30 +0200 Subject: [PATCH] Add some and improve other tests (more assertk idiomatic) --- api/stalla.api | 235 ++++++++++++++---- src/test/kotlin/dev/stalla/Assertions.kt | 40 +++ ...ValidatingGeographicLocationBuilderTest.kt | 60 +++++ .../kotlin/dev/stalla/model/MediaTypeTest.kt | 14 +- .../podcastindex/GeographicLocationTest.kt | 11 +- .../model/podcastindex/TranscriptTypeTest.kt | 8 +- 6 files changed, 307 insertions(+), 61 deletions(-) diff --git a/api/stalla.api b/api/stalla.api index 4f485d9c..e9e6f9af 100644 --- a/api/stalla.api +++ b/api/stalla.api @@ -50,6 +50,29 @@ public abstract interface class dev/stalla/builder/Builder { public abstract fun getHasEnoughDataToBuild ()Z } +public abstract interface class dev/stalla/builder/GeographicLocationBuilder : dev/stalla/builder/Builder { + public abstract fun addAllParameters (Ljava/util/List;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun addParameter (Ldev/stalla/model/podcastindex/GeographicLocation$Parameter;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun addParameter (Ljava/lang/String;Ljava/lang/String;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun altitude (Ljava/lang/Double;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun applyFrom (Ldev/stalla/model/podcastindex/GeographicLocation;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun crs (Ljava/lang/String;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun hasAltitude ()Z + public abstract fun hasLatitude ()Z + public abstract fun hasLongitude ()Z + public abstract fun latitude (D)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun longitude (D)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun removeParameter (Ldev/stalla/model/podcastindex/GeographicLocation$Parameter;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun removeParameter (Ljava/lang/String;)Ldev/stalla/builder/GeographicLocationBuilder; + public abstract fun uncertainty (Ljava/lang/Double;)Ldev/stalla/builder/GeographicLocationBuilder; +} + +public final class dev/stalla/builder/GeographicLocationBuilder$DefaultImpls { + public static fun addAllParameters (Ldev/stalla/builder/GeographicLocationBuilder;Ljava/util/List;)Ldev/stalla/builder/GeographicLocationBuilder; + public static fun addParameter (Ldev/stalla/builder/GeographicLocationBuilder;Ldev/stalla/model/podcastindex/GeographicLocation$Parameter;)Ldev/stalla/builder/GeographicLocationBuilder; + public static fun applyFrom (Ldev/stalla/builder/GeographicLocationBuilder;Ldev/stalla/model/podcastindex/GeographicLocation;)Ldev/stalla/builder/GeographicLocationBuilder; +} + public abstract interface class dev/stalla/builder/HrefOnlyImageBuilder : dev/stalla/builder/Builder { public abstract fun applyFrom (Ldev/stalla/model/HrefOnlyImage;)Ldev/stalla/builder/HrefOnlyImageBuilder; public abstract fun href (Ljava/lang/String;)Ldev/stalla/builder/HrefOnlyImageBuilder; @@ -74,6 +97,43 @@ public final class dev/stalla/builder/LinkBuilder$DefaultImpls { public static fun applyFrom (Ldev/stalla/builder/LinkBuilder;Ldev/stalla/model/atom/Link;)Ldev/stalla/builder/LinkBuilder; } +public abstract interface class dev/stalla/builder/OpenStreetMapElementBuilder : dev/stalla/builder/Builder { + public abstract fun applyFrom (Ldev/stalla/model/podcastindex/OpenStreetMapElement;)Ldev/stalla/builder/OpenStreetMapElementBuilder; + public abstract fun id (J)Ldev/stalla/builder/OpenStreetMapElementBuilder; + public abstract fun revision (Ljava/lang/Integer;)Ldev/stalla/builder/OpenStreetMapElementBuilder; + public abstract fun type (Ldev/stalla/model/podcastindex/OpenStreetMapElementType;)Ldev/stalla/builder/OpenStreetMapElementBuilder; +} + +public final class dev/stalla/builder/OpenStreetMapElementBuilder$DefaultImpls { + public static fun applyFrom (Ldev/stalla/builder/OpenStreetMapElementBuilder;Ldev/stalla/model/podcastindex/OpenStreetMapElement;)Ldev/stalla/builder/OpenStreetMapElementBuilder; + public static fun id (Ldev/stalla/builder/OpenStreetMapElementBuilder;J)Ldev/stalla/builder/OpenStreetMapElementBuilder; + public static fun revision (Ldev/stalla/builder/OpenStreetMapElementBuilder;Ljava/lang/Integer;)Ldev/stalla/builder/OpenStreetMapElementBuilder; +} + +public abstract interface class dev/stalla/builder/PodcastindexLocationBuilder : dev/stalla/builder/Builder { + public abstract fun applyFrom (Ldev/stalla/model/podcastindex/PodcastindexLocation;)Ldev/stalla/builder/PodcastindexLocationBuilder; + public abstract fun geo (Ldev/stalla/model/podcastindex/GeographicLocation;)Ldev/stalla/builder/PodcastindexLocationBuilder; + public abstract fun name (Ljava/lang/String;)Ldev/stalla/builder/PodcastindexLocationBuilder; + public abstract fun osm (Ldev/stalla/model/podcastindex/OpenStreetMapElement;)Ldev/stalla/builder/PodcastindexLocationBuilder; +} + +public final class dev/stalla/builder/PodcastindexLocationBuilder$DefaultImpls { + public static fun applyFrom (Ldev/stalla/builder/PodcastindexLocationBuilder;Ldev/stalla/model/podcastindex/PodcastindexLocation;)Ldev/stalla/builder/PodcastindexLocationBuilder; +} + +public abstract interface class dev/stalla/builder/PodcastindexPersonBuilder : dev/stalla/builder/Builder { + public abstract fun applyFrom (Ldev/stalla/model/podcastindex/PodcastindexPerson;)Ldev/stalla/builder/PodcastindexPersonBuilder; + public abstract fun group (Ljava/lang/String;)Ldev/stalla/builder/PodcastindexPersonBuilder; + public abstract fun href (Ljava/lang/String;)Ldev/stalla/builder/PodcastindexPersonBuilder; + public abstract fun img (Ljava/lang/String;)Ldev/stalla/builder/PodcastindexPersonBuilder; + public abstract fun name (Ljava/lang/String;)Ldev/stalla/builder/PodcastindexPersonBuilder; + public abstract fun role (Ljava/lang/String;)Ldev/stalla/builder/PodcastindexPersonBuilder; +} + +public final class dev/stalla/builder/PodcastindexPersonBuilder$DefaultImpls { + public static fun applyFrom (Ldev/stalla/builder/PodcastindexPersonBuilder;Ldev/stalla/model/podcastindex/PodcastindexPerson;)Ldev/stalla/builder/PodcastindexPersonBuilder; +} + public abstract interface class dev/stalla/builder/RssCategoryBuilder : dev/stalla/builder/Builder { public abstract fun applyFrom (Ldev/stalla/model/rss/RssCategory;)Ldev/stalla/builder/RssCategoryBuilder; public abstract fun category (Ljava/lang/String;)Ldev/stalla/builder/RssCategoryBuilder; @@ -199,15 +259,21 @@ public final class dev/stalla/builder/episode/EpisodeItunesBuilder$DefaultImpls } public abstract interface class dev/stalla/builder/episode/EpisodePodcastindexBuilder : dev/stalla/builder/Builder { + public abstract fun addAllPersonBuilders (Ljava/util/List;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public abstract fun addAllSoundbiteBuilders (Ljava/util/List;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public abstract fun addAllTranscriptBuilders (Ljava/util/List;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; + public abstract fun addPersonBuilder (Ldev/stalla/builder/PodcastindexPersonBuilder;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public abstract fun addSoundbiteBuilder (Ldev/stalla/builder/episode/EpisodePodcastindexSoundbiteBuilder;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public abstract fun addTranscriptBuilder (Ldev/stalla/builder/episode/EpisodePodcastindexTranscriptBuilder;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public abstract fun applyFrom (Ldev/stalla/model/podcastindex/EpisodePodcastindex;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public abstract fun chaptersBuilder (Ldev/stalla/builder/episode/EpisodePodcastindexChaptersBuilder;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; + public abstract fun episodeBuilder (Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; + public abstract fun locationBuilder (Ldev/stalla/builder/PodcastindexLocationBuilder;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; + public abstract fun seasonBuilder (Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; } public final class dev/stalla/builder/episode/EpisodePodcastindexBuilder$DefaultImpls { + public static fun addAllPersonBuilders (Ldev/stalla/builder/episode/EpisodePodcastindexBuilder;Ljava/util/List;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public static fun addAllSoundbiteBuilders (Ldev/stalla/builder/episode/EpisodePodcastindexBuilder;Ljava/util/List;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public static fun addAllTranscriptBuilders (Ldev/stalla/builder/episode/EpisodePodcastindexBuilder;Ljava/util/List;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; public static fun applyFrom (Ldev/stalla/builder/episode/EpisodePodcastindexBuilder;Ldev/stalla/model/podcastindex/EpisodePodcastindex;)Ldev/stalla/builder/episode/EpisodePodcastindexBuilder; @@ -223,6 +289,26 @@ public final class dev/stalla/builder/episode/EpisodePodcastindexChaptersBuilder public static fun applyFrom (Ldev/stalla/builder/episode/EpisodePodcastindexChaptersBuilder;Ldev/stalla/model/podcastindex/Chapters;)Ldev/stalla/builder/episode/EpisodePodcastindexChaptersBuilder; } +public abstract interface class dev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder : dev/stalla/builder/Builder { + public abstract fun applyFrom (Ldev/stalla/model/podcastindex/PodcastindexEpisode;)Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder; + public abstract fun display (Ljava/lang/String;)Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder; + public abstract fun number (D)Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder; +} + +public final class dev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder$DefaultImpls { + public static fun applyFrom (Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder;Ldev/stalla/model/podcastindex/PodcastindexEpisode;)Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder; +} + +public abstract interface class dev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder : dev/stalla/builder/Builder { + public abstract fun applyFrom (Ldev/stalla/model/podcastindex/PodcastindexSeason;)Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder; + public abstract fun name (Ljava/lang/String;)Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder; + public abstract fun number (I)Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder; +} + +public final class dev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder$DefaultImpls { + public static fun applyFrom (Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder;Ldev/stalla/model/podcastindex/PodcastindexSeason;)Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder; +} + public abstract interface class dev/stalla/builder/episode/EpisodePodcastindexSoundbiteBuilder : dev/stalla/builder/Builder { public abstract fun applyFrom (Ldev/stalla/model/podcastindex/Soundbite;)Ldev/stalla/builder/episode/EpisodePodcastindexSoundbiteBuilder; public abstract fun duration (Ldev/stalla/model/StyledDuration$SecondsAndFraction;)Ldev/stalla/builder/episode/EpisodePodcastindexSoundbiteBuilder; @@ -376,13 +462,17 @@ public final class dev/stalla/builder/podcast/PodcastItunesOwnerBuilder$DefaultI public abstract interface class dev/stalla/builder/podcast/PodcastPodcastindexBuilder : dev/stalla/builder/Builder { public abstract fun addAllFundingBuilders (Ljava/util/List;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; + public abstract fun addAllPersonBuilders (Ljava/util/List;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; public abstract fun addFundingBuilder (Ldev/stalla/builder/podcast/PodcastPodcastindexFundingBuilder;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; + public abstract fun addPersonBuilder (Ldev/stalla/builder/PodcastindexPersonBuilder;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; public abstract fun applyFrom (Ldev/stalla/model/podcastindex/PodcastPodcastindex;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; + public abstract fun locationBuilder (Ldev/stalla/builder/PodcastindexLocationBuilder;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; public abstract fun lockedBuilder (Ldev/stalla/builder/podcast/PodcastPodcastindexLockedBuilder;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; } public final class dev/stalla/builder/podcast/PodcastPodcastindexBuilder$DefaultImpls { public static fun addAllFundingBuilders (Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder;Ljava/util/List;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; + public static fun addAllPersonBuilders (Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder;Ljava/util/List;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; public static fun applyFrom (Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder;Ldev/stalla/model/podcastindex/PodcastPodcastindex;)Ldev/stalla/builder/podcast/PodcastPodcastindexBuilder; } @@ -1311,26 +1401,43 @@ public final class dev/stalla/model/podcastindex/Funding$Factory : dev/stalla/mo public fun builder ()Ldev/stalla/builder/podcast/PodcastPodcastindexFundingBuilder; } -public final class dev/stalla/model/podcastindex/GeoLocation { - public static final field Factory Ldev/stalla/model/podcastindex/GeoLocation$Factory; - public final fun getCoordA ()D - public final fun getCoordB ()D - public final fun getCoordC ()Ljava/lang/Double; - public final fun getParameters ()Ljava/util/Map; - public static fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/GeoLocation; +public final class dev/stalla/model/podcastindex/GeographicLocation { + public static final field CRS_WGS84 Ljava/lang/String; + public static final field Factory Ldev/stalla/model/podcastindex/GeographicLocation$Factory; + public fun (DDLjava/lang/Double;Ljava/lang/String;Ljava/lang/Double;Ljava/util/List;)V + public synthetic fun (DDLjava/lang/Double;Ljava/lang/String;Ljava/lang/Double;Ljava/util/List;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (DDLjava/lang/Double;Ljava/lang/String;Ljava/lang/Double;Ljava/util/Map;)V + public static fun builder ()Ldev/stalla/builder/GeographicLocationBuilder; + public fun equals (Ljava/lang/Object;)Z + public final fun getAltitude ()Ljava/lang/Double; + public final fun getCrs ()Ljava/lang/String; + public final fun getLatitude ()D + public final fun getLongitude ()D + public final fun getParameters ()Ljava/util/List; + public final fun getUncertainty ()Ljava/lang/Double; + public fun hashCode ()I + public final fun match (Ldev/stalla/model/podcastindex/GeographicLocation;)Z + public final fun match (Ljava/lang/String;)Z + public static fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/GeographicLocation; + public final fun parameter (Ljava/lang/String;)Ljava/lang/String; + public fun toString ()Ljava/lang/String; + public final fun withParameter (Ljava/lang/String;Ljava/lang/String;)Ldev/stalla/model/podcastindex/GeographicLocation; + public final fun withoutParameters ()Ldev/stalla/model/podcastindex/GeographicLocation; } -public final class dev/stalla/model/podcastindex/GeoLocation$Factory : dev/stalla/model/TypeFactory { - public fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/GeoLocation; +public final class dev/stalla/model/podcastindex/GeographicLocation$Factory : dev/stalla/model/BuilderFactory, dev/stalla/model/TypeFactory { + public synthetic fun builder ()Ldev/stalla/builder/Builder; + public fun builder ()Ldev/stalla/builder/GeographicLocationBuilder; + public fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/GeographicLocation; public synthetic fun of (Ljava/lang/String;)Ljava/lang/Object; } -public final class dev/stalla/model/podcastindex/GeoLocation$Parameter { +public final class dev/stalla/model/podcastindex/GeographicLocation$Parameter { public fun (Ljava/lang/String;Ljava/lang/String;)V public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; - public final fun copy (Ljava/lang/String;Ljava/lang/String;)Ldev/stalla/model/podcastindex/GeoLocation$Parameter; - public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/GeoLocation$Parameter;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/GeoLocation$Parameter; + public final fun copy (Ljava/lang/String;Ljava/lang/String;)Ldev/stalla/model/podcastindex/GeographicLocation$Parameter; + public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/GeographicLocation$Parameter;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/GeographicLocation$Parameter; public fun equals (Ljava/lang/Object;)Z public final fun getKey ()Ljava/lang/String; public final fun getValue ()Ljava/lang/String; @@ -1358,34 +1465,46 @@ public final class dev/stalla/model/podcastindex/Locked$Factory : dev/stalla/mod public fun builder ()Ldev/stalla/builder/podcast/PodcastPodcastindexLockedBuilder; } -public final class dev/stalla/model/podcastindex/OpenStreetMapFeature { - public fun (Ldev/stalla/model/podcastindex/OsmType;ILjava/lang/String;)V - public final fun component1 ()Ldev/stalla/model/podcastindex/OsmType; - public final fun component2 ()I - public final fun component3 ()Ljava/lang/String; - public final fun copy (Ldev/stalla/model/podcastindex/OsmType;ILjava/lang/String;)Ldev/stalla/model/podcastindex/OpenStreetMapFeature; - public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/OpenStreetMapFeature;Ldev/stalla/model/podcastindex/OsmType;ILjava/lang/String;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/OpenStreetMapFeature; +public final class dev/stalla/model/podcastindex/OpenStreetMapElement { + public static final field Factory Ldev/stalla/model/podcastindex/OpenStreetMapElement$Factory; + public fun (Ldev/stalla/model/podcastindex/OpenStreetMapElementType;JLjava/lang/Integer;)V + public static fun builder ()Ldev/stalla/builder/OpenStreetMapElementBuilder; + public final fun component1 ()Ldev/stalla/model/podcastindex/OpenStreetMapElementType; + public final fun component2 ()J + public final fun component3 ()Ljava/lang/Integer; + public final fun copy (Ldev/stalla/model/podcastindex/OpenStreetMapElementType;JLjava/lang/Integer;)Ldev/stalla/model/podcastindex/OpenStreetMapElement; + public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/OpenStreetMapElement;Ldev/stalla/model/podcastindex/OpenStreetMapElementType;JLjava/lang/Integer;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/OpenStreetMapElement; public fun equals (Ljava/lang/Object;)Z - public final fun getOsmId ()I - public final fun getOsmRevision ()Ljava/lang/String; - public final fun getOsmType ()Ldev/stalla/model/podcastindex/OsmType; + public final fun getId ()J + public final fun getRevision ()Ljava/lang/Integer; + public final fun getType ()Ldev/stalla/model/podcastindex/OpenStreetMapElementType; public fun hashCode ()I + public static fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OpenStreetMapElement; public fun toString ()Ljava/lang/String; } -public final class dev/stalla/model/podcastindex/OsmType : java/lang/Enum { - public static final field Factory Ldev/stalla/model/podcastindex/OsmType$Factory; - public static final field Node Ldev/stalla/model/podcastindex/OsmType; - public static final field Relation Ldev/stalla/model/podcastindex/OsmType; - public static final field Way Ldev/stalla/model/podcastindex/OsmType; +public final class dev/stalla/model/podcastindex/OpenStreetMapElement$Factory : dev/stalla/model/BuilderFactory, dev/stalla/model/TypeFactory { + public synthetic fun builder ()Ldev/stalla/builder/Builder; + public fun builder ()Ldev/stalla/builder/OpenStreetMapElementBuilder; + public fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OpenStreetMapElement; + public synthetic fun of (Ljava/lang/String;)Ljava/lang/Object; +} + +public final class dev/stalla/model/podcastindex/OpenStreetMapElementType : java/lang/Enum { + public static final field Factory Ldev/stalla/model/podcastindex/OpenStreetMapElementType$Factory; + public static final field Node Ldev/stalla/model/podcastindex/OpenStreetMapElementType; + public static final field Relation Ldev/stalla/model/podcastindex/OpenStreetMapElementType; + public static final field Way Ldev/stalla/model/podcastindex/OpenStreetMapElementType; public final fun getType ()Ljava/lang/String; - public static fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OsmType; - public static fun valueOf (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OsmType; - public static fun values ()[Ldev/stalla/model/podcastindex/OsmType; + public static final fun of (Ljava/lang/Character;)Ldev/stalla/model/podcastindex/OpenStreetMapElementType; + public static fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OpenStreetMapElementType; + public static fun valueOf (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OpenStreetMapElementType; + public static fun values ()[Ldev/stalla/model/podcastindex/OpenStreetMapElementType; } -public final class dev/stalla/model/podcastindex/OsmType$Factory : dev/stalla/model/TypeFactory { - public fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OsmType; +public final class dev/stalla/model/podcastindex/OpenStreetMapElementType$Factory : dev/stalla/model/TypeFactory { + public final fun of (Ljava/lang/Character;)Ldev/stalla/model/podcastindex/OpenStreetMapElementType; + public fun of (Ljava/lang/String;)Ldev/stalla/model/podcastindex/OpenStreetMapElementType; public synthetic fun of (Ljava/lang/String;)Ljava/lang/Object; } @@ -1416,7 +1535,9 @@ public final class dev/stalla/model/podcastindex/PodcastPodcastindex$Factory : d } public final class dev/stalla/model/podcastindex/PodcastindexEpisode { + public static final field Factory Ldev/stalla/model/podcastindex/PodcastindexEpisode$Factory; public fun (DLjava/lang/String;)V + public static fun builder ()Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder; public final fun component1 ()D public final fun component2 ()Ljava/lang/String; public final fun copy (DLjava/lang/String;)Ldev/stalla/model/podcastindex/PodcastindexEpisode; @@ -1428,23 +1549,37 @@ public final class dev/stalla/model/podcastindex/PodcastindexEpisode { public fun toString ()Ljava/lang/String; } +public final class dev/stalla/model/podcastindex/PodcastindexEpisode$Factory : dev/stalla/model/BuilderFactory { + public synthetic fun builder ()Ldev/stalla/builder/Builder; + public fun builder ()Ldev/stalla/builder/episode/EpisodePodcastindexEpisodeBuilder; +} + public final class dev/stalla/model/podcastindex/PodcastindexLocation { - public fun (Ljava/lang/String;Ldev/stalla/model/podcastindex/GeoLocation;Ldev/stalla/model/podcastindex/OpenStreetMapFeature;)V + public static final field Factory Ldev/stalla/model/podcastindex/PodcastindexLocation$Factory; + public fun (Ljava/lang/String;Ldev/stalla/model/podcastindex/GeographicLocation;Ldev/stalla/model/podcastindex/OpenStreetMapElement;)V + public static fun builder ()Ldev/stalla/builder/PodcastindexLocationBuilder; public final fun component1 ()Ljava/lang/String; - public final fun component2 ()Ldev/stalla/model/podcastindex/GeoLocation; - public final fun component3 ()Ldev/stalla/model/podcastindex/OpenStreetMapFeature; - public final fun copy (Ljava/lang/String;Ldev/stalla/model/podcastindex/GeoLocation;Ldev/stalla/model/podcastindex/OpenStreetMapFeature;)Ldev/stalla/model/podcastindex/PodcastindexLocation; - public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/PodcastindexLocation;Ljava/lang/String;Ldev/stalla/model/podcastindex/GeoLocation;Ldev/stalla/model/podcastindex/OpenStreetMapFeature;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/PodcastindexLocation; + public final fun component2 ()Ldev/stalla/model/podcastindex/GeographicLocation; + public final fun component3 ()Ldev/stalla/model/podcastindex/OpenStreetMapElement; + public final fun copy (Ljava/lang/String;Ldev/stalla/model/podcastindex/GeographicLocation;Ldev/stalla/model/podcastindex/OpenStreetMapElement;)Ldev/stalla/model/podcastindex/PodcastindexLocation; + public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/PodcastindexLocation;Ljava/lang/String;Ldev/stalla/model/podcastindex/GeographicLocation;Ldev/stalla/model/podcastindex/OpenStreetMapElement;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/PodcastindexLocation; public fun equals (Ljava/lang/Object;)Z - public final fun getGeo ()Ldev/stalla/model/podcastindex/GeoLocation; + public final fun getGeo ()Ldev/stalla/model/podcastindex/GeographicLocation; public final fun getName ()Ljava/lang/String; - public final fun getOsm ()Ldev/stalla/model/podcastindex/OpenStreetMapFeature; + public final fun getOsm ()Ldev/stalla/model/podcastindex/OpenStreetMapElement; public fun hashCode ()I public fun toString ()Ljava/lang/String; } +public final class dev/stalla/model/podcastindex/PodcastindexLocation$Factory : dev/stalla/model/BuilderFactory { + public synthetic fun builder ()Ldev/stalla/builder/Builder; + public fun builder ()Ldev/stalla/builder/PodcastindexLocationBuilder; +} + public final class dev/stalla/model/podcastindex/PodcastindexPerson { + public static final field Factory Ldev/stalla/model/podcastindex/PodcastindexPerson$Factory; public fun (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V + public static fun builder ()Ldev/stalla/builder/PodcastindexPersonBuilder; public final fun component1 ()Ljava/lang/String; public final fun component2 ()Ljava/lang/String; public final fun component3 ()Ljava/lang/String; @@ -1462,19 +1597,31 @@ public final class dev/stalla/model/podcastindex/PodcastindexPerson { public fun toString ()Ljava/lang/String; } +public final class dev/stalla/model/podcastindex/PodcastindexPerson$Factory : dev/stalla/model/BuilderFactory { + public synthetic fun builder ()Ldev/stalla/builder/Builder; + public fun builder ()Ldev/stalla/builder/PodcastindexPersonBuilder; +} + public final class dev/stalla/model/podcastindex/PodcastindexSeason { - public fun (DLjava/lang/String;)V - public final fun component1 ()D + public static final field Factory Ldev/stalla/model/podcastindex/PodcastindexSeason$Factory; + public fun (ILjava/lang/String;)V + public static fun builder ()Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder; + public final fun component1 ()I public final fun component2 ()Ljava/lang/String; - public final fun copy (DLjava/lang/String;)Ldev/stalla/model/podcastindex/PodcastindexSeason; - public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/PodcastindexSeason;DLjava/lang/String;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/PodcastindexSeason; + public final fun copy (ILjava/lang/String;)Ldev/stalla/model/podcastindex/PodcastindexSeason; + public static synthetic fun copy$default (Ldev/stalla/model/podcastindex/PodcastindexSeason;ILjava/lang/String;ILjava/lang/Object;)Ldev/stalla/model/podcastindex/PodcastindexSeason; public fun equals (Ljava/lang/Object;)Z public final fun getName ()Ljava/lang/String; - public final fun getNumber ()D + public final fun getNumber ()I public fun hashCode ()I public fun toString ()Ljava/lang/String; } +public final class dev/stalla/model/podcastindex/PodcastindexSeason$Factory : dev/stalla/model/BuilderFactory { + public synthetic fun builder ()Ldev/stalla/builder/Builder; + public fun builder ()Ldev/stalla/builder/episode/EpisodePodcastindexSeasonBuilder; +} + public final class dev/stalla/model/podcastindex/Soundbite { public static final field Factory Ldev/stalla/model/podcastindex/Soundbite$Factory; public fun (Ldev/stalla/model/StyledDuration$SecondsAndFraction;Ldev/stalla/model/StyledDuration$SecondsAndFraction;Ljava/lang/String;)V diff --git a/src/test/kotlin/dev/stalla/Assertions.kt b/src/test/kotlin/dev/stalla/Assertions.kt index 893ff5f0..0ee9d294 100644 --- a/src/test/kotlin/dev/stalla/Assertions.kt +++ b/src/test/kotlin/dev/stalla/Assertions.kt @@ -231,3 +231,43 @@ internal fun Assert.matchPattern(expected: GeographicLocatio actual = geoLocation ) } + +/** Asserts that there exists a [MediaType.Parameter] with the expected key and value. */ +@JvmName("hasMediaTypeParameterWithValue") +internal fun Assert.hasParameterWithValue(expectedKey: String, expectedValue: String) = given { mediaType -> + val actualValue = mediaType.parameter(expectedKey) + if (actualValue != null && actualValue == expectedValue) return@given + if (actualValue == null) { + expected( + "to be have a value for key: '$expectedKey'", + expected = expectedValue, + actual = actualValue + ) + } else { + expected( + "to be: $expectedKey=$expectedValue but was: $expectedKey=$actualValue", + expected = expectedValue, + actual = actualValue + ) + } +} + +/** Asserts that there exists a [GeographicLocation.Parameter] with the expected key and value. */ +@JvmName("hasGeographicLocationParameterWithValue") +internal fun Assert.hasParameterWithValue(expectedKey: String, expectedValue: String) = given { geo -> + val actualValue = geo.parameter(expectedKey) + if (actualValue != null && actualValue == expectedValue) return@given + if (actualValue == null) { + expected( + "to be have a value for key: '$expectedKey'", + expected = expectedValue, + actual = actualValue + ) + } else { + expected( + "to be: $expectedKey=$expectedValue but was: $expectedKey=$actualValue", + expected = expectedValue, + actual = actualValue + ) + } +} diff --git a/src/test/kotlin/dev/stalla/builder/validating/ValidatingGeographicLocationBuilderTest.kt b/src/test/kotlin/dev/stalla/builder/validating/ValidatingGeographicLocationBuilderTest.kt index c6b9657c..fc182960 100644 --- a/src/test/kotlin/dev/stalla/builder/validating/ValidatingGeographicLocationBuilderTest.kt +++ b/src/test/kotlin/dev/stalla/builder/validating/ValidatingGeographicLocationBuilderTest.kt @@ -3,6 +3,7 @@ package dev.stalla.builder.validating import assertk.all import assertk.assertAll import assertk.assertThat +import assertk.assertions.hasSize import assertk.assertions.isEqualTo import assertk.assertions.isFalse import assertk.assertions.isNotNull @@ -10,6 +11,7 @@ import assertk.assertions.isNull import assertk.assertions.isTrue import assertk.assertions.prop import dev.stalla.builder.GeographicLocationBuilder +import dev.stalla.hasParameterWithValue import dev.stalla.model.aPodcastindexGeographicLocation import dev.stalla.model.podcastindex.GeographicLocation import org.junit.jupiter.api.Test @@ -43,6 +45,64 @@ internal class ValidatingGeographicLocationBuilderTest { } } + @Test + internal fun `should recognize a valid GeographicLocation CRS parameter when adding it as a normal parameter`() { + val geoBuilder = ValidatingGeographicLocationBuilder() + .latitude(1.0) + .longitude(2.0) + .addParameter("crs", "TEST") + + assertAll { + assertThat(geoBuilder).prop(GeographicLocationBuilder::hasEnoughDataToBuild).isTrue() + + assertThat(geoBuilder.build()).isNotNull().all { + prop(GeographicLocation::latitude).isEqualTo(1.0) + prop(GeographicLocation::longitude).isEqualTo(2.0) + prop(GeographicLocation::crs).isEqualTo("TEST") + prop(GeographicLocation::parameters).hasSize(0) + } + } + } + + @Test + internal fun `should recognize a valid GeographicLocation uncertainty parameter when adding it as a normal parameter`() { + val geoBuilder = ValidatingGeographicLocationBuilder() + .latitude(1.0) + .longitude(2.0) + .addParameter("u", "4.12") + + assertAll { + assertThat(geoBuilder).prop(GeographicLocationBuilder::hasEnoughDataToBuild).isTrue() + + assertThat(geoBuilder.build()).isNotNull().all { + prop(GeographicLocation::latitude).isEqualTo(1.0) + prop(GeographicLocation::longitude).isEqualTo(2.0) + prop(GeographicLocation::uncertainty).isEqualTo(4.12) + prop(GeographicLocation::parameters).hasSize(0) + } + } + } + + @Test + internal fun `should treat an invalid GeographicLocation uncertainty parameter as a normal parameter when adding it as a normal parameter`() { + val geoBuilder = ValidatingGeographicLocationBuilder() + .latitude(1.0) + .longitude(2.0) + .addParameter("u", "abc") + + assertAll { + assertThat(geoBuilder).prop(GeographicLocationBuilder::hasEnoughDataToBuild).isTrue() + + assertThat(geoBuilder.build()).isNotNull().all { + prop(GeographicLocation::latitude).isEqualTo(1.0) + prop(GeographicLocation::longitude).isEqualTo(2.0) + prop(GeographicLocation::uncertainty).isNull() + prop(GeographicLocation::parameters).hasSize(1) + hasParameterWithValue("u", "abc") + } + } + } + @Test internal fun `should populate a GeographicLocation builder with all properties from an GeographicLocation model`() { val geo = aPodcastindexGeographicLocation() diff --git a/src/test/kotlin/dev/stalla/model/MediaTypeTest.kt b/src/test/kotlin/dev/stalla/model/MediaTypeTest.kt index 39072a67..55998406 100644 --- a/src/test/kotlin/dev/stalla/model/MediaTypeTest.kt +++ b/src/test/kotlin/dev/stalla/model/MediaTypeTest.kt @@ -15,9 +15,9 @@ import assertk.assertions.prop import dev.stalla.arguments import dev.stalla.doesNotMatchSymmetrically import dev.stalla.equalToString +import dev.stalla.hasParameterWithValue import dev.stalla.matchPattern import dev.stalla.matchesSymmetrically -import dev.stalla.model.podcastindex.TranscriptType import org.junit.jupiter.api.Test import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.ArgumentsProvider @@ -113,7 +113,8 @@ internal class MediaTypeTest { prop(MediaType::type).isEqualTo("text") prop(MediaType::subtype).isEqualTo("plain") prop(MediaType::parameters).hasSize(1) - prop("parameter") { MediaType::parameter.call(it, "charset") }.isNotNull().isEqualTo("utf-8") + hasParameterWithValue("charset", "utf-8") +// prop("parameter") { MediaType::parameter.call(it, "charset") }.isNotNull().isEqualTo("utf-8") } } @@ -218,7 +219,7 @@ internal class MediaTypeTest { prop(MediaType::type).isEqualTo("audio") prop(MediaType::subtype).isEqualTo("*") prop(MediaType::parameters).hasSize(1) - prop("parameter") { MediaType::parameter.call(it, "attr") }.isNotNull().isEqualTo("v>alue") + hasParameterWithValue("attr", "v>alue") } } @@ -310,7 +311,7 @@ internal class MediaTypeTest { prop(MediaType::type).isEqualTo("multipart") prop(MediaType::subtype).isEqualTo("mixed") prop(MediaType::parameters).hasSize(1) - prop("parameter") { MediaType::parameter.call(it, "boundary") }.isNotNull().isEqualTo("gc0pJq0M:08jU534c0p") + hasParameterWithValue("boundary", "gc0pJq0M:08jU534c0p") } } @@ -359,7 +360,7 @@ internal class MediaTypeTest { @Test fun `should render parameters correctly`() { assertThat(MediaType.PLAIN_TEXT.withParameter("p1", "v1")).isNotNull() - .prop("toString") { MediaType::toString.call(it) }.isEqualTo("text/plain; p1=v1") + .equalToString("text/plain; p1=v1") } @Test @@ -413,8 +414,7 @@ internal class MediaTypeTest { @ParameterizedTest @ArgumentsSource(MediaTypeNameProvider::class) fun `should retrieve all predefined types from the factory method`(typeName: String) { - assertThat(MediaType.of(typeName)).isNotNull() - .prop("toString") { TranscriptType::toString.call(it) }.isEqualTo(typeName) + assertThat(MediaType.of(typeName)).isNotNull().equalToString(typeName) } @ParameterizedTest diff --git a/src/test/kotlin/dev/stalla/model/podcastindex/GeographicLocationTest.kt b/src/test/kotlin/dev/stalla/model/podcastindex/GeographicLocationTest.kt index 533c4dba..7db5abeb 100644 --- a/src/test/kotlin/dev/stalla/model/podcastindex/GeographicLocationTest.kt +++ b/src/test/kotlin/dev/stalla/model/podcastindex/GeographicLocationTest.kt @@ -11,6 +11,7 @@ import assertk.assertions.isNotNull import assertk.assertions.isNull import assertk.assertions.isTrue import assertk.assertions.prop +import dev.stalla.hasParameterWithValue import org.junit.jupiter.api.Test class GeographicLocationTest { @@ -60,7 +61,7 @@ class GeographicLocationTest { prop(GeographicLocation::crs).isEqualTo("wgs84") prop(GeographicLocation::uncertainty).isEqualTo(12.0) prop(GeographicLocation::parameters).hasSize(1) - prop("parameter") { GeographicLocation::parameter.call(it, "param") }.isNotNull().isEqualTo("value") + hasParameterWithValue("param", "value") } } @@ -109,7 +110,7 @@ class GeographicLocationTest { prop(GeographicLocation::crs).isNull() prop(GeographicLocation::uncertainty).isNull() prop(GeographicLocation::parameters).hasSize(1) - prop("parameter") { GeographicLocation::parameter.call(it, "u") }.isNotNull().isEqualTo("invalid") + hasParameterWithValue("u", "invalid") } } @@ -142,7 +143,7 @@ class GeographicLocationTest { prop(GeographicLocation::crs).isNull() prop(GeographicLocation::uncertainty).isNull() prop(GeographicLocation::parameters).hasSize(1) - prop("parameter") { GeographicLocation::parameter.call(it, "param") }.isNotNull().isEqualTo("with = special & chars") + hasParameterWithValue("param", "with = special & chars") } } @@ -155,8 +156,8 @@ class GeographicLocationTest { prop(GeographicLocation::crs).isEqualTo("theCrs") prop(GeographicLocation::uncertainty).isEqualTo(12.0) prop(GeographicLocation::parameters).hasSize(2) - prop("parameter") { GeographicLocation::parameter.call(it, "param") }.isNotNull().isEqualTo("value") - prop("parameter") { GeographicLocation::parameter.call(it, "param2") }.isNotNull().isEqualTo("value2") + hasParameterWithValue("param", "value") + hasParameterWithValue("param2", "value2") } } diff --git a/src/test/kotlin/dev/stalla/model/podcastindex/TranscriptTypeTest.kt b/src/test/kotlin/dev/stalla/model/podcastindex/TranscriptTypeTest.kt index 1b447e21..056cd71e 100644 --- a/src/test/kotlin/dev/stalla/model/podcastindex/TranscriptTypeTest.kt +++ b/src/test/kotlin/dev/stalla/model/podcastindex/TranscriptTypeTest.kt @@ -6,8 +6,8 @@ import assertk.assertions.isEqualTo import assertk.assertions.isInstanceOf import assertk.assertions.isNotNull import assertk.assertions.isNull -import assertk.assertions.prop import dev.stalla.arguments +import dev.stalla.equalToString import dev.stalla.model.MediaType import dev.stalla.model.TranscriptTypeNameProvider import dev.stalla.model.allTranscriptTypeNames @@ -40,8 +40,7 @@ internal class TranscriptTypeTest { @ParameterizedTest @ArgumentsSource(TranscriptTypeNameProvider::class) fun `should retrieve all Transcript Types from the factory method`(typeName: String) { - assertThat(TranscriptType.of(typeName)).isNotNull() - .prop("toString") { TranscriptType::toString.call(it) }.isEqualTo(typeName) + assertThat(TranscriptType.of(typeName)).isNotNull().equalToString(typeName) } @ParameterizedTest @@ -77,8 +76,7 @@ internal class TranscriptTypeTest { @Test fun `should be case insensitive in the Podcastindex transcript type factory method`() { - assertThat(TranscriptType.of("TEXT/PLAIN")).isNotNull() - .prop("toString") { TranscriptType::toString.call(it) }.isEqualTo("text/plain") + assertThat(TranscriptType.of("TEXT/PLAIN")).isNotNull().equalToString("text/plain") } @Test