Repository: avro-kotlin/avro4k
Pull request #103 (2021-06-11 13:10:02)

Value (former inline) class serialization support
Depends on Serialization 1.2 (Kotlin 1.5)


Patch:
diff --git a/build.gradle.kts b/build.gradle.kts
index 5c9de03..f636630 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -11,7 +11,7 @@ plugins {
    java
    id("java-library")
    kotlin("jvm") version Libs.kotlinVersion
-   id("org.jetbrains.kotlin.plugin.serialization") version Libs.kotlinVersion
+   kotlin("plugin.serialization") version Libs.kotlinVersion
    id("maven-publish")
    signing
    // id("org.jetbrains.dokka") version Libs.dokkaVersion
@@ -46,8 +46,8 @@ dependencies {
 
 tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
    kotlinOptions.jvmTarget = "1.8"
-   kotlinOptions.apiVersion = "1.4"
-   kotlinOptions.languageVersion = "1.4"
+   kotlinOptions.apiVersion = "1.5"
+   kotlinOptions.languageVersion = "1.5"
    kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
 }
 
@@ -156,4 +156,4 @@ publishing {
          }
       }
    }
-}
\ No newline at end of file
+}
diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt
index 318c363..1800069 100644
--- a/buildSrc/src/main/kotlin/Libs.kt
+++ b/buildSrc/src/main/kotlin/Libs.kt
@@ -1,8 +1,8 @@
 object Libs {
 
-   const val kotlinVersion = "1.4.32"
+   const val kotlinVersion = "1.5.20-RC"
    // const val dokkaVersion = "1.4.20"
-   const val kotestGradlePlugin = "0.2.6"
+   const val kotestGradlePlugin = "0.3.8"
    const val versionsPlugin = "0.38.0"
 
    object Kotest {
@@ -14,7 +14,7 @@ object Libs {
    }
 
    object Kotlinx {
-      private const val version = "1.1.0"
+      private const val version = "1.2.1"
       const val serializationCore = "org.jetbrains.kotlinx:kotlinx-serialization-core:$version"
       const val serializationJson = "org.jetbrains.kotlinx:kotlinx-serialization-json:$version"
    }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f371643..0f80bbf 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/src/main/kotlin/com/github/avrokotlin/avro4k/schema/SchemaFor.kt b/src/main/kotlin/com/github/avrokotlin/avro4k/schema/SchemaFor.kt
index f53e182..bfe3fb3 100644
--- a/src/main/kotlin/com/github/avrokotlin/avro4k/schema/SchemaFor.kt
+++ b/src/main/kotlin/com/github/avrokotlin/avro4k/schema/SchemaFor.kt
@@ -174,7 +174,7 @@ fun schemaFor(serializersModule: SerializersModule,
 
    val schemaFor: SchemaFor = when (underlying) {
       is AvroDescriptor -> SchemaFor.const(underlying.schema(annos, serializersModule, namingStrategy))
-      else -> when (descriptor.kind) {
+      else -> when (descriptor.carrierDescriptor.kind) {
          PrimitiveKind.STRING -> SchemaFor.StringSchemaFor
          PrimitiveKind.LONG -> SchemaFor.LongSchemaFor
          PrimitiveKind.INT -> SchemaFor.IntSchemaFor
@@ -209,3 +209,8 @@ fun schemaFor(serializersModule: SerializersModule,
 
    return if (descriptor.isNullable) NullableSchemaFor(schemaFor, annos) else schemaFor
 }
+
+// copy-paste from kotlinx serialization because it internal
+@ExperimentalSerializationApi
+internal val SerialDescriptor.carrierDescriptor: SerialDescriptor
+   get() = if (isInline) getElementDescriptor(0) else this
\ No newline at end of file
diff --git a/src/main/kotlin/com/github/avrokotlin/avro4k/schema/namingStrategy.kt b/src/main/kotlin/com/github/avrokotlin/avro4k/schema/namingStrategy.kt
index 460356c..fc6dc39 100644
--- a/src/main/kotlin/com/github/avrokotlin/avro4k/schema/namingStrategy.kt
+++ b/src/main/kotlin/com/github/avrokotlin/avro4k/schema/namingStrategy.kt
@@ -1,7 +1,5 @@
 package com.github.avrokotlin.avro4k.schema
 
-import java.util.Locale
-
 interface NamingStrategy {
    fun to(name: String): String = name
 }
@@ -11,14 +9,14 @@ object DefaultNamingStrategy : NamingStrategy {
 }
 
 object PascalCaseNamingStrategy : NamingStrategy {
-   override fun to(name: String): String = name.take(1).toUpperCase(Locale.ROOT) + name.drop(1)
+   override fun to(name: String): String = name.take(1).uppercase() + name.drop(1)
 }
 
 object SnakeCaseNamingStrategy : NamingStrategy {
    override fun to(name: String): String = name.fold(StringBuilder()) { sb, c ->
       if (c.isUpperCase())
-         sb.append('_').append(c.toLowerCase())
+         sb.append('_').append(c.lowercase())
       else
-         sb.append(c.toLowerCase())
+         sb.append(c.lowercase())
    }.toString()
 }


Test patch:
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/DefaultAvroTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/DefaultAvroTest.kt
index 1dbfa31..14b47a4 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/DefaultAvroTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/DefaultAvroTest.kt
@@ -9,12 +9,11 @@ import java.util.UUID
 class DefaultAvroTest : FunSpec({
 
     test("encoding UUID") {
-
-        @Serializable
-        data class Foo(@Contextual val a: UUID)
-
         val uuid = UUID.randomUUID()
         val record = Avro.default.toRecord(Foo.serializer(), Foo(uuid))
         record.get("a").toString() shouldBe uuid.toString()
     }
-})
+}) {
+    @Serializable
+    data class Foo(@Contextual val a: UUID)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/RecordEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/RecordEncoderTest.kt
index 4e6c15e..32c9c0f 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/RecordEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/RecordEncoderTest.kt
@@ -8,19 +8,19 @@ class RecordEncoderTest : FunSpec({
 
    test("encoding basic data class") {
 
-      @Serializable
-      data class Foo(val a: String, val b: Double, val c: Boolean)
-
       // Avro.default.dump(Foo.serializer(), Foo("hello", 123.456, true)) shouldBe ""
    }
 
    test("to/from records of sets of ints") {
 
-      @Serializable
-      data class S(val t: Set<Int>)
-
       val r = Avro.default.toRecord(S.serializer(), S(setOf(1)))
       val s = Avro.default.fromRecord(S.serializer(), r)  // this line fails
       s.t shouldBe setOf(1)
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class Foo(val a: String, val b: Double, val c: Boolean)
+
+   @Serializable
+   data class S(val t: Set<Int>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroInlineDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroInlineDecoderTest.kt
index bd1d227..ead2141 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroInlineDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroInlineDecoderTest.kt
@@ -12,16 +12,17 @@ class AvroInlineDecoderTest : FunSpec({
 
    test("decode @AvroInline") {
 
-      @Serializable
-      @AvroInline
-      data class Name(val value: String)
-
-      @Serializable
-      data class Product(val id: String, val name: Name)
-
       val schema = Avro.default.schema(Product.serializer())
       val record =  ListRecord(schema, listOf(Utf8("123"), Utf8("sneakers")))
       Avro.default.fromRecord(Product.serializer(), record) shouldBe Product("123", Name("sneakers"))
    }
 
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   @AvroInline
+   data class Name(val value: String)
+
+   @Serializable
+   data class Product(val id: String, val name: Name)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroNameDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroNameDecoderTest.kt
index 1dd3c94..f501d93 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroNameDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/AvroNameDecoderTest.kt
@@ -10,13 +10,14 @@ import org.apache.avro.util.Utf8
 
 class AvroNameDecoderTest : FunSpec({
 
-   @Serializable
-   data class Foo(@AvroName("bar") val foo: String)
-
    test("decoder should take into account @AvroName on fields") {
       val schema = Avro.default.schema(Foo.serializer())
       val record = GenericData.Record(schema)
       record.put("bar", Utf8("hello"))
       Avro.default.fromRecord(Foo.serializer(), record) shouldBe Foo("hello")
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class Foo(@AvroName("bar") val foo: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigDecimalDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigDecimalDecoderTest.kt
index f92c3be..7f01cb4 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigDecimalDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigDecimalDecoderTest.kt
@@ -20,9 +20,6 @@ class BigDecimalDecoderTest : FunSpec({
 
    test("decode big decimals from bytes") {
 
-      @Serializable
-      data class Test(val b: BigDecimal)
-
       val logical = LogicalTypes.decimal(8, 2)
 
       val schema = SchemaBuilder.record("Test").fields()
@@ -39,9 +36,6 @@ class BigDecimalDecoderTest : FunSpec({
 
    test("decode big decimals from strings") {
 
-      @Serializable
-      data class Test(val b: BigDecimal)
-
       val schema = SchemaBuilder.record("Test").fields()
          .name("b").type(Schema.create(Schema.Type.STRING)).noDefault()
          .endRecord()
@@ -54,9 +48,6 @@ class BigDecimalDecoderTest : FunSpec({
 
    test("decode big decimals from fixed") {
 
-      @Serializable
-      data class Test(val b: BigDecimal)
-
       val logical = LogicalTypes.decimal(10, 8)
 
       val schema = SchemaBuilder.record("Test").fields()
@@ -68,4 +59,8 @@ class BigDecimalDecoderTest : FunSpec({
 
       Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(BigDecimal("12345678.00000000"))
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class Test(val b: BigDecimal)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigIntegerDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigIntegerDecoderTest.kt
index 1d570be..2eb4ffc 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigIntegerDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/BigIntegerDecoderTest.kt
@@ -18,9 +18,6 @@ class BigIntegerDecoderTest : FunSpec({
 
    test("decode big integer from string") {
 
-      @Serializable
-      data class Test(val b: BigInteger)
-
       val schema = SchemaBuilder.record("Test").fields().name("b").type(Schema.create(Schema.Type.STRING)).noDefault().endRecord()
 
       val record = GenericData.Record(schema)
@@ -28,4 +25,8 @@ class BigIntegerDecoderTest : FunSpec({
 
       Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(BigInteger("1927398217318546456532973912379127391279312983719"))
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class Test(val b: BigInteger)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/ByteArrayDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/ByteArrayDecoderTest.kt
index 8ba3cb6..a87df85 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/ByteArrayDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/ByteArrayDecoderTest.kt
@@ -9,15 +9,6 @@ import java.nio.ByteBuffer
 
 class ByteArrayDecoderTest : FunSpec({
 
-   @Serializable
-   data class ByteArrayTest(val z: ByteArray)
-
-   @Serializable
-   data class ArrayByteTest(val z: Array<Byte>)
-
-   @Serializable
-   data class ListByteTest(val z: List<Byte>)
-
    test("decode ByteBuffer to ByteArray") {
       val schema = Avro.default.schema(ByteArrayTest.serializer())
       val record = GenericData.Record(schema)
@@ -101,4 +92,14 @@ class ByteArrayDecoderTest : FunSpec({
       record.put("z", listOf<Byte>(1, 4, 9))
       Avro.default.fromRecord(ArrayByteTest.serializer(), record).z shouldBe arrayOf<Byte>(1, 4, 9)
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class ByteArrayTest(val z: ByteArray)
+
+   @Serializable
+   data class ArrayByteTest(val z: Array<Byte>)
+
+   @Serializable
+   data class ListByteTest(val z: List<Byte>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/DateDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/DateDecoderTest.kt
index a37abe3..9032d91 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/DateDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/DateDecoderTest.kt
@@ -23,24 +23,6 @@ import java.time.temporal.ChronoUnit
 
 class DateDecoderTest : FunSpec({
 
-   @Serializable
-   data class WithLocalTime(val z: LocalTime)
-
-   @Serializable
-   data class WithLocalDate(val z: LocalDate)
-
-   @Serializable
-   data class WithLocalDateTime(val z: LocalDateTime)
-
-   @Serializable
-   data class WithTimestamp(val z: Timestamp)
-
-   @Serializable
-   data class WithInstant(@Serializable(with = InstantSerializer::class) val z: Instant)
-
-   @Serializable
-   data class WithInstantAndMicros(@Serializable(with = InstantToMicroSerializer::class) val z: Instant)
-
    test("decode int to LocalTime") {
       val schema = Avro.default.schema(WithLocalTime.serializer())
       val record = GenericData.Record(schema)
@@ -88,4 +70,23 @@ class DateDecoderTest : FunSpec({
       Avro.default.fromRecord(WithInstantAndMicros.serializer(), record) shouldBe
          WithInstantAndMicros(Instant.ofEpochMilli(1538312231000L).plus(100, ChronoUnit.MICROS))
    }
-})
+}) {
+
+   @Serializable
+   data class WithLocalTime(val z: LocalTime)
+
+   @Serializable
+   data class WithLocalDate(val z: LocalDate)
+
+   @Serializable
+   data class WithLocalDateTime(val z: LocalDateTime)
+
+   @Serializable
+   data class WithTimestamp(val z: Timestamp)
+
+   @Serializable
+   data class WithInstant(@Serializable(with = InstantSerializer::class) val z: Instant)
+
+   @Serializable
+   data class WithInstantAndMicros(@Serializable(with = InstantToMicroSerializer::class) val z: Instant)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/FixedDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/FixedDecoderTest.kt
index 134745b..079450e 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/FixedDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/FixedDecoderTest.kt
@@ -10,12 +10,6 @@ import org.apache.avro.generic.GenericData
 
 class FixedDecoderTest : FunSpec({
 
-  @Serializable
-  data class FixedString(val z: String)
-
-  @Serializable
-  data class NullableFixedType(val z: FixedString?)
-
   test("decode bytes to String") {
     val schema = SchemaBuilder.record("FixedString").fields()
         .name("z").type(Schema.createFixed("z", null, "ns", 10)).noDefault()
@@ -33,4 +27,11 @@ class FixedDecoderTest : FunSpec({
 //        FixedValueType("sam")))
 //  }
 
-})
\ No newline at end of file
+}) {
+
+  @Serializable
+  data class FixedString(val z: String)
+
+  @Serializable
+  data class NullableFixedType(val z: FixedString?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/MapDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/MapDecoderTest.kt
index 975a6a8..229837b 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/MapDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/MapDecoderTest.kt
@@ -12,62 +12,38 @@ import java.nio.ByteBuffer
 class MapDecoderTest : StringSpec({
 
    "decode a Map<String, Long> from strings/longs" {
-      @Serializable
-      data class Test(val a: Map<String, Long>)
 
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(MapStringLong.serializer())
 
       val record = GenericData.Record(schema)
       record.put("a", mapOf("x" to 152134L, "y" to 917823L))
 
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(mapOf("x" to 152134L, "y" to 917823L))
+      Avro.default.fromRecord(MapStringLong.serializer(), record) shouldBe MapStringLong(mapOf("x" to 152134L, "y" to 917823L))
    }
 
    "decode a Map<String, Long> from utf8s/longs" {
-      @Serializable
-      data class Test(val a: Map<String, Long>)
 
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(MapStringLong.serializer())
 
       val record = GenericData.Record(schema)
       record.put("a", mapOf(Utf8("x") to 152134L, Utf8("y") to 917823L))
 
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(mapOf("x" to 152134L, "y" to 917823L))
+      Avro.default.fromRecord(MapStringLong.serializer(), record) shouldBe MapStringLong(mapOf("x" to 152134L, "y" to 917823L))
    }
 
    "decode a Map<String, String> from utf8s/utf8s" {
-      @Serializable
-      data class Test(val a: Map<String, String>)
 
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(MapStringString.serializer())
 
       val record = GenericData.Record(schema)
       record.put("a", mapOf(Utf8("x") to Utf8("a"), Utf8("y") to Utf8("b")))
 
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(mapOf("x" to "a", "y" to "b"))
+      Avro.default.fromRecord(MapStringString.serializer(), record) shouldBe MapStringString(mapOf("x" to "a", "y" to "b"))
    }
 
    "decode a Map<String, ByteArray> from utf8s/ByteBuffer" {
-      @Serializable
-      data class Test(val a: Map<String, ByteArray>) {
-         override fun equals(other: Any?): Boolean{
-            if (this === other) return true
-            if (other?.javaClass != javaClass) return false
 
-            other as Test
-
-            if (a.size != other.a.size) return false
-            if (a.keys != other.a.keys) return false
-
-            return a.map {
-               it.value.contentEquals(other.a[it.key]!!)
-            }.all { it }
-         }
-
-         override fun hashCode() = a.hashCode()
-      }
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(MapStringByteArray.serializer())
 
       val record = GenericData.Record(schema)
       record.put("a", mapOf(
@@ -76,7 +52,7 @@ class MapDecoderTest : StringSpec({
          Utf8("c") to ByteBuffer.wrap("z".toByteArray())
       ))
 
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(mapOf(
+      Avro.default.fromRecord(MapStringByteArray.serializer(), record) shouldBe MapStringByteArray(mapOf(
          "a" to "x".toByteArray(),
          "b" to "y".toByteArray(),
          "c" to "z".toByteArray()
@@ -85,13 +61,7 @@ class MapDecoderTest : StringSpec({
 
    "decode a Map of records" {
 
-      @Serializable
-      data class Foo(val a: String, val b: Boolean)
-
-      @Serializable
-      data class Test(val a: Map<String, Foo>)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(MapStringStructure.serializer())
       val fooSchema = Avro.default.schema(Foo.serializer())
 
       val xRecord = ListRecord(fooSchema, Utf8("x"), true)
@@ -100,7 +70,39 @@ class MapDecoderTest : StringSpec({
       val record = GenericData.Record(schema)
       record.put("a", mapOf("a" to xRecord, "b" to yRecord))
 
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe
-         Test(mapOf("a" to Foo("x", true), "b" to Foo("y", false)))
+      Avro.default.fromRecord(MapStringStructure.serializer(), record) shouldBe
+          MapStringStructure(mapOf("a" to Foo("x", true), "b" to Foo("y", false)))
+   }
+}) {
+
+   @Serializable
+   data class MapStringLong(val a: Map<String, Long>)
+
+   @Serializable
+   data class MapStringString(val a: Map<String, String>)
+
+   @Serializable
+   data class MapStringByteArray(val a: Map<String, ByteArray>) {
+      override fun equals(other: Any?): Boolean{
+         if (this === other) return true
+         if (other?.javaClass != javaClass) return false
+
+         other as MapStringByteArray
+
+         if (a.size != other.a.size) return false
+         if (a.keys != other.a.keys) return false
+
+         return a.map {
+            it.value.contentEquals(other.a[it.key]!!)
+         }.all { it }
+      }
+
+      override fun hashCode() = a.hashCode()
    }
-})
\ No newline at end of file
+
+   @Serializable
+   data class Foo(val a: String, val b: Boolean)
+
+   @Serializable
+   data class MapStringStructure(val a: Map<String, Foo>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/NamingStrategyDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/NamingStrategyDecoderTest.kt
index fc164d9..ecbab66 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/NamingStrategyDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/NamingStrategyDecoderTest.kt
@@ -12,8 +12,6 @@ import org.apache.avro.util.Utf8
 
 class NamingStrategyDecoderTest : WordSpec({
    "Decoder" should {
-      @Serializable
-      data class Foo(val fooBar: String)
 
       "support decoding fields with snake_casing" {
          val snakeCaseAvro = Avro(AvroConfiguration(SnakeCaseNamingStrategy))
@@ -33,4 +31,7 @@ class NamingStrategyDecoderTest : WordSpec({
          pascalCaseAvro.fromRecord(Foo.serializer(), record) shouldBe Foo("hello")
       }
    }
-})
+}) {
+   @Serializable
+   data class Foo(val fooBar: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/TransientDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/TransientDecoderTest.kt
index e8dcd92..78d68b2 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/TransientDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/TransientDecoderTest.kt
@@ -11,12 +11,12 @@ class TransientDecoderTest : FunSpec({
 
    test("decoder should populate transient fields with default") {
 
-      @Serializable
-      data class TransientFoo(val a: String, @Transient val b: String = "world")
-
       val schema = Avro.default.schema(TransientFoo.serializer())
       val record = GenericData.Record(schema)
       record.put("a", "hello")
       Avro.default.fromRecord(TransientFoo.serializer(), record) shouldBe TransientFoo("hello", "world")
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class TransientFoo(val a: String, @Transient val b: String = "world")
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/URLDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/URLDecoderTest.kt
index 6b0ff42..f733e08 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/URLDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/URLDecoderTest.kt
@@ -16,52 +16,47 @@ class URLDecoderTest : FunSpec({
 
    test("decode String to URL") {
 
-      @Serializable
-      data class Test(val b: URL)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(TestUrl.serializer())
 
       val record = GenericData.Record(schema)
       record.put("b", "http://www.sksamuel.com")
 
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(URL("http://www.sksamuel.com"))
+      Avro.default.fromRecord(TestUrl.serializer(), record) shouldBe TestUrl(URL("http://www.sksamuel.com"))
    }
 
    test("decode UT8 to URL") {
 
-      @Serializable
-      data class Test(val b: URL)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(TestUrl.serializer())
 
       val record = GenericData.Record(schema)
       record.put("b", Utf8("http://www.sksamuel.com"))
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(URL("http://www.sksamuel.com"))
+      Avro.default.fromRecord(TestUrl.serializer(), record) shouldBe TestUrl(URL("http://www.sksamuel.com"))
    }
 
    test("decode list of Strings to URL") {
 
-      @Serializable
-      data class Test(val urls: List<URL>)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(TestUrlList.serializer())
 
       val record = GenericData.Record(schema)
       record.put("urls", listOf("http://www.sksamuel.com", "https://sksamuel.com"))
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(listOf(URL("http://www.sksamuel.com"), URL("https://sksamuel.com")))
+      Avro.default.fromRecord(TestUrlList.serializer(), record) shouldBe TestUrlList(listOf(URL("http://www.sksamuel.com"), URL("https://sksamuel.com")))
 
    }
 
    test("decode list of UT8s to URL") {
 
-      @Serializable
-      data class Test(val urls: List<URL>)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(TestUrlList.serializer())
 
       val record = GenericData.Record(schema)
       record.put("urls", listOf(Utf8("http://www.sksamuel.com"), Utf8("https://sksamuel.com")))
-      Avro.default.fromRecord(Test.serializer(), record) shouldBe Test(listOf(URL("http://www.sksamuel.com"), URL("https://sksamuel.com")))
+      Avro.default.fromRecord(TestUrlList.serializer(), record) shouldBe TestUrlList(listOf(URL("http://www.sksamuel.com"), URL("https://sksamuel.com")))
 
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class TestUrl(val b: URL)
+
+   @Serializable
+   data class TestUrlList(val urls: List<URL>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/UUIDDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/UUIDDecoderTest.kt
index 28b0942..a5ab431 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/UUIDDecoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/UUIDDecoderTest.kt
@@ -16,9 +16,6 @@ class UUIDDecoderTest : StringSpec({
 
    "decode uuids"  {
 
-      @Serializable
-      data class UUIDTest(val uuid: UUID)
-
       val uuid = UUID.randomUUID()
       val schema = Avro.default.schema(UUIDTest.serializer())
       val record = GenericData.Record(schema)
@@ -29,9 +26,6 @@ class UUIDDecoderTest : StringSpec({
 
    "decode UUIDSs encoded as Utf8"  {
 
-      @Serializable
-      data class UUIDTest(val uuid: UUID)
-
       val uuid = UUID.randomUUID()
       val schema = Avro.default.schema(UUIDTest.serializer())
 
@@ -43,35 +37,39 @@ class UUIDDecoderTest : StringSpec({
 
    "decode list of uuids"  {
 
-      @Serializable
-      data class UUIDTest(val uuids: List<UUID>)
-
       val uuid1 = UUID.randomUUID()
       val uuid2 = UUID.randomUUID()
-      val schema = Avro.default.schema(UUIDTest.serializer())
+      val schema = Avro.default.schema(UUIDListTest.serializer())
 
       val record = GenericData.Record(schema)
       record.put("uuids", listOf(uuid1.toString(), uuid2.toString()))
 
-      Avro.default.fromRecord(UUIDTest.serializer(), record) shouldBe UUIDTest(listOf(uuid1, uuid2))
+      Avro.default.fromRecord(UUIDListTest.serializer(), record) shouldBe UUIDListTest(listOf(uuid1, uuid2))
    }
 
    "decode nullable UUIDs"  {
 
-      @Serializable
-      data class UUIDTest(val uuid: UUID?)
-
       val uuid = UUID.randomUUID()
-      val schema = Avro.default.schema(UUIDTest.serializer())
+      val schema = Avro.default.schema(UUIDNullableTest.serializer())
 
       val record1 = GenericData.Record(schema)
       record1.put("uuid", uuid.toString())
 
-      Avro.default.fromRecord(UUIDTest.serializer(), record1) shouldBe UUIDTest(uuid)
+      Avro.default.fromRecord(UUIDNullableTest.serializer(), record1) shouldBe UUIDNullableTest(uuid)
 
       val record2 = GenericData.Record(schema)
       record2.put("uuid", null)
 
-      Avro.default.fromRecord(UUIDTest.serializer(), record2) shouldBe UUIDTest(null)
+      Avro.default.fromRecord(UUIDNullableTest.serializer(), record2) shouldBe UUIDNullableTest(null)
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class UUIDTest(val uuid: UUID)
+
+   @Serializable
+   data class UUIDListTest(val uuids: List<UUID>)
+
+
+   @Serializable
+   data class UUIDNullableTest(val uuid: UUID?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/ValueClassDecoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/ValueClassDecoderTest.kt
new file mode 100644
index 0000000..73fb7e4
--- /dev/null
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/decoder/ValueClassDecoderTest.kt
@@ -0,0 +1,21 @@
+package com.github.avrokotlin.avro4k.decoder
+
+import com.github.avrokotlin.avro4k.Avro
+import com.github.avrokotlin.avro4k.schema.ValueClassSchemaTest.ContainsInlineTest
+import com.github.avrokotlin.avro4k.schema.ValueClassSchemaTest.StringWrapper
+import io.kotest.matchers.shouldBe
+import io.kotest.core.spec.style.StringSpec
+import org.apache.avro.generic.GenericData
+
+class ValueClassDecoderTest : StringSpec({
+
+   "decode value class" {
+
+      val id = StringWrapper("100500")
+      val schema = Avro.default.schema(ContainsInlineTest.serializer())
+      val record = GenericData.Record(schema)
+      record.put("id", id.a)
+
+      Avro.default.fromRecord(ContainsInlineTest.serializer(), record) shouldBe ContainsInlineTest(id)
+   }
+})
\ No newline at end of file
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ArrayEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ArrayEncoderTest.kt
index 54e8008..26a4772 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ArrayEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ArrayEncoderTest.kt
@@ -12,21 +12,17 @@ class ArrayEncoderTest : WordSpec({
 
    "Encoder" should {
       "generate GenericData.Array for an Array<Boolean>" {
-         @Serializable
-         data class Test(val a: Array<Boolean>)
 
-         val schema = Avro.default.schema(Test.serializer())
+         val schema = Avro.default.schema(ArrayBooleanTest.serializer())
          val arraySchema = schema.getField("a").schema()
-         val record = Avro.default.toRecord(Test.serializer(), Test(arrayOf(true, false, true)))
+         val record = Avro.default.toRecord(ArrayBooleanTest.serializer(), ArrayBooleanTest(arrayOf(true, false, true)))
          record shouldBe ListRecord(schema, listOf(GenericData.Array(arraySchema, listOf(true, false, true))))
       }
       "support GenericData.Array for an Array<Boolean> with other fields" {
-         @Serializable
-         data class Test(val a: String, val b: Array<Boolean>, val c: Long)
 
-         val schema = Avro.default.schema(Test.serializer())
+         val schema = Avro.default.schema(ArrayBooleanWithOthersTest.serializer())
          val arraySchema = schema.getField("b").schema()
-         val record = Avro.default.toRecord(Test.serializer(), Test("foo", arrayOf(true, false, true), 123L))
+         val record = Avro.default.toRecord(ArrayBooleanWithOthersTest.serializer(), ArrayBooleanWithOthersTest("foo", arrayOf(true, false, true), 123L))
          record shouldBe ListRecord(
             schema,
             Utf8("foo"),
@@ -35,25 +31,21 @@ class ArrayEncoderTest : WordSpec({
          )
       }
       "generate GenericData.Array for a List<String>" {
-         @Serializable
-         data class Test(val a: List<String>)
 
-         val schema = Avro.default.schema(Test.serializer())
+         val schema = Avro.default.schema(ListStringTest.serializer())
          val arraySchema = schema.getField("a").schema()
-         val record = Avro.default.toRecord(Test.serializer(), Test(listOf("we23", "54z")))
+         val record = Avro.default.toRecord(ListStringTest.serializer(), ListStringTest(listOf("we23", "54z")))
          record shouldBe ListRecord(
             schema,
             listOf(GenericData.Array(arraySchema, listOf(Utf8("we23"), Utf8("54z"))))
          )
       }
       "generate GenericData.Array for a Set<Long>" {
-         @Serializable
-         data class Test(val a: Set<Long>)
 
-         val schema = Avro.default.schema(Test.serializer())
+         val schema = Avro.default.schema(SetLongTest.serializer())
          val arraySchema = schema.getField("a").schema()
          val expected = ListRecord(schema, listOf(GenericData.Array(arraySchema, listOf(123L, 643L, 912))))
-         val actual = Avro.default.toRecord(Test.serializer(), Test(setOf(123L, 643L, 912L)))
+         val actual = Avro.default.toRecord(SetLongTest.serializer(), SetLongTest(setOf(123L, 643L, 912L)))
          actual shouldBe expected
       }
 //    "generate array for an Array of records" {
@@ -120,5 +112,16 @@ class ArrayEncoderTest : WordSpec({
 //      )
 //    }
    }
-})
+}) {
+   @Serializable
+   data class ArrayBooleanTest(val a: Array<Boolean>)
 
+   @Serializable
+   data class ArrayBooleanWithOthersTest(val a: String, val b: Array<Boolean>, val c: Long)
+
+   @Serializable
+   data class SetLongTest(val a: Set<Long>)
+
+   @Serializable
+   data class ListStringTest(val a: List<String>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroInlineEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroInlineEncoderTest.kt
index 2897069..fd894cd 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroInlineEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroInlineEncoderTest.kt
@@ -12,16 +12,17 @@ class AvroInlineEncoderTest : FunSpec({
 
    test("encode @AvroInline") {
 
-      @Serializable
-      @AvroInline
-      data class Name(val value: String)
-
-      @Serializable
-      data class Product(val id: String, val name: Name)
-
       val schema = Avro.default.schema(Product.serializer())
       val record = Avro.default.toRecord(Product.serializer(), Product("123", Name("sneakers")))
       record shouldBe ListRecord(schema, listOf(Utf8("123"), Utf8("sneakers")))
    }
 
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   @AvroInline
+   data class Name(val value: String)
+
+   @Serializable
+   data class Product(val id: String, val name: Name)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroNameEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroNameEncoderTest.kt
index 9be2886..950cbed 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroNameEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/AvroNameEncoderTest.kt
@@ -11,9 +11,10 @@ import org.apache.avro.util.Utf8
 class AvroNameEncoderTest : FunSpec({
 
    test("encoder should take into account @AvroName on fields") {
-      @Serializable
-      data class Foo(@AvroName("bar") val foo: String)
       val schema = Avro.default.schema(Foo.serializer())
       Avro.default.toRecord(Foo.serializer(), Foo("hello")) shouldBe ListRecord(schema, listOf(Utf8("hello")))
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class Foo(@AvroName("bar") val foo: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BasicEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BasicEncoderTest.kt
index 7452cbd..b4f1e17 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BasicEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BasicEncoderTest.kt
@@ -15,81 +15,85 @@ class BasicEncoderTest : WordSpec({
    "Encoder" should {
       "encode strings as UTF8"  {
 
-         @Serializable
-         data class Foo(val s: String)
-
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo("hello"))
+         val schema = Avro.default.schema(StringFoo.serializer())
+         val record = Avro.default.toRecord(StringFoo.serializer(), StringFoo("hello"))
          record shouldBe ListRecord(schema, Utf8("hello"))
       }
       "encode strings as GenericFixed and pad bytes when schema is Type.FIXED" {
-         @Serializable
-         data class Foo(val s: String)
 
          val schema = SchemaBuilder.record("Foo").fields()
             .name("s").type(Schema.createFixed("FixedString", null, null, 7)).noDefault()
             .endRecord()
 
-         (Avro.default.toRecord(Foo.serializer(), schema, Foo("hello"))["s"] as GenericData.Fixed).bytes() shouldBe
+         (Avro.default.toRecord(StringFoo.serializer(), schema, StringFoo("hello"))["s"] as GenericData.Fixed).bytes() shouldBe
             byteArrayOf(104, 101, 108, 108, 111, 0, 0)
       }
       "encode longs" {
-         @Serializable
-         data class Foo(val l: Long)
 
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo(123456L))
+         val schema = Avro.default.schema(LongFoo.serializer())
+         val record = Avro.default.toRecord(LongFoo.serializer(), LongFoo(123456L))
          record shouldBe ListRecord(schema, 123456L)
       }
       "encode doubles" {
-         @Serializable
-         data class Foo(val d: Double)
 
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo(123.435))
+         val schema = Avro.default.schema(DoubleFoo.serializer())
+         val record = Avro.default.toRecord(DoubleFoo.serializer(), DoubleFoo(123.435))
          record shouldBe ListRecord(schema, 123.435)
       }
       "encode booleans" {
-         @Serializable
-         data class Foo(val d: Boolean)
 
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo(true))
+         val schema = Avro.default.schema(BooleanFoo.serializer())
+         val record = Avro.default.toRecord(BooleanFoo.serializer(), BooleanFoo(true))
          record shouldBe ListRecord(schema, true)
       }
       "encode floats" {
-         @Serializable
-         data class Foo(val d: Float)
 
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo(123.435F))
+         val schema = Avro.default.schema(FloatFoo.serializer())
+         val record = Avro.default.toRecord(FloatFoo.serializer(), FloatFoo(123.435F))
          record shouldBe ListRecord(schema, 123.435F)
       }
       "encode ints" {
-         @Serializable
-         data class Foo(val i: Int)
 
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo(123))
+         val schema = Avro.default.schema(IntFoo.serializer())
+         val record = Avro.default.toRecord(IntFoo.serializer(), IntFoo(123))
          record shouldBe ListRecord(schema, 123)
       }
       "encode shorts" {
-         @Serializable
-         data class Foo(val s: Short)
 
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo(123.toShort()))
+         val schema = Avro.default.schema(ShortFoo.serializer())
+         val record = Avro.default.toRecord(ShortFoo.serializer(), ShortFoo(123.toShort()))
          record shouldBe ListRecord(schema, 123.toShort())
       }
       "encode bytes" {
-         @Serializable
-         data class Foo(val b: Byte)
 
-         val schema = Avro.default.schema(Foo.serializer())
-         val record = Avro.default.toRecord(Foo.serializer(), Foo(123.toByte()))
+         val schema = Avro.default.schema(ByteFoo.serializer())
+         val record = Avro.default.toRecord(ByteFoo.serializer(), ByteFoo(123.toByte()))
          record shouldBe ListRecord(schema, 123.toByte())
       }
    }
 
-})
+}) {
+   @Serializable
+   data class StringFoo(val s: String)
+
+   @Serializable
+   data class LongFoo(val l: Long)
+
+   @Serializable
+   data class DoubleFoo(val d: Double)
+
+   @Serializable
+   data class BooleanFoo(val d: Boolean)
+
+   @Serializable
+   data class FloatFoo(val d: Float)
+
+   @Serializable
+   data class IntFoo(val i: Int)
+
+   @Serializable
+   data class ShortFoo(val s: Short)
 
+   @Serializable
+   data class ByteFoo(val b: Byte)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigDecimalEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigDecimalEncoderTest.kt
index 2a43f0d..d045f53 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigDecimalEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigDecimalEncoderTest.kt
@@ -21,28 +21,22 @@ class BigDecimalEncoderTest : FunSpec({
 
    test("use byte array for decimal") {
 
-      @Serializable
-      data class Test(val decimal: BigDecimal)
+      val schema = Avro.default.schema(BigDecimalTest.serializer())
 
-      val schema = Avro.default.schema(Test.serializer())
-
-      val obj = Test(BigDecimal("12.34"))
+      val obj = BigDecimalTest(BigDecimal("12.34"))
       val s = schema.getField("decimal").schema()
       val bytes = Conversions.DecimalConversion().toBytes(BigDecimal("12.34"), s, s.logicalType)
 
-      Avro.default.toRecord(Test.serializer(), schema, obj) shouldBe ListRecord(schema, bytes)
+      Avro.default.toRecord(BigDecimalTest.serializer(), schema, obj) shouldBe ListRecord(schema, bytes)
    }
 
    test("allow decimals to be encoded as strings") {
 
-      @Serializable
-      data class Test(val decimal: BigDecimal)
-
       val schema = SchemaBuilder.record("Test").fields()
          .name("decimal").type(Schema.create(Schema.Type.STRING)).noDefault()
          .endRecord()
 
-      Avro.default.toRecord(Test.serializer(), schema, Test(BigDecimal("123.456"))) shouldBe
+      Avro.default.toRecord(BigDecimalTest.serializer(), schema, BigDecimalTest(BigDecimal("123.456"))) shouldBe
          ListRecord(schema, Utf8("123.456"))
    }
 
@@ -65,31 +59,32 @@ class BigDecimalEncoderTest : FunSpec({
 
    test("support nullable big decimals") {
 
-      @Serializable
-      data class Test(val big: BigDecimal?)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(NullableBigDecimalTest.serializer())
 
       val s = schema.getField("big").schema().types.first { it.type != Schema.Type.NULL }
       val bytes = Conversions.DecimalConversion().toBytes(BigDecimal("123.4").setScale(2), s, s.logicalType)
 
-      Avro.default.toRecord(Test.serializer(), schema, Test(BigDecimal("123.4"))) shouldBe ListRecord(schema, bytes)
-      Avro.default.toRecord(Test.serializer(), schema, Test(null)) shouldBe ListRecord(schema, null)
+      Avro.default.toRecord(NullableBigDecimalTest.serializer(), schema, NullableBigDecimalTest(BigDecimal("123.4"))) shouldBe ListRecord(schema, bytes)
+      Avro.default.toRecord(NullableBigDecimalTest.serializer(), schema, NullableBigDecimalTest(null)) shouldBe ListRecord(schema, null)
    }
 
    test("allow bigdecimals to be encoded as generic fixed") {
 
-      @Serializable
-      data class Test(val big: BigDecimal)
 
       //Schema needs to have the precision of 16 in order to serialize a 8 digit integer with a scale of 8
-      val decimal = LogicalTypes.decimal(16, 8).addToSchema(Schema.createFixed("big", null, null, 8))
+      val decimal = LogicalTypes.decimal(16, 8).addToSchema(Schema.createFixed("decimal", null, null, 8))
 
       val schema = SchemaBuilder.record("Test").fields()
-         .name("big").type(decimal).noDefault()
+         .name("decimal").type(decimal).noDefault()
          .endRecord()
 
-      val big = Avro.default.toRecord(Test.serializer(), schema, Test(BigDecimal("12345678"))).get("big") as GenericFixed
+      val big = Avro.default.toRecord(BigDecimalTest.serializer(), schema, BigDecimalTest(BigDecimal("12345678"))).get("decimal") as GenericFixed
       big.bytes() shouldBe byteArrayOf(0, 4, 98, -43, 55, 43, -114, 0)
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class BigDecimalTest(val decimal: BigDecimal)
+
+   @Serializable
+   data class NullableBigDecimalTest(val big: BigDecimal?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigIntegerEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigIntegerEncoderTest.kt
index f4d2399..f664152 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigIntegerEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/BigIntegerEncoderTest.kt
@@ -16,25 +16,26 @@ class BigIntegerEncoderTest : FunSpec({
 
    test("use string for bigint") {
 
-      @Serializable
-      data class Test(val b: BigInteger)
+      val schema = Avro.default.schema(BigIntegerTest.serializer())
 
-      val schema = Avro.default.schema(Test.serializer())
+      val test = BigIntegerTest(BigInteger("123123123123213213213123214325365477686789676234"))
 
-      val test = Test(BigInteger("123123123123213213213123214325365477686789676234"))
-
-      Avro.default.toRecord(Test.serializer(), schema, test) shouldBe ListRecord(schema, Utf8("123123123123213213213123214325365477686789676234"))
+      Avro.default.toRecord(BigIntegerTest.serializer(), schema, test) shouldBe ListRecord(schema, Utf8("123123123123213213213123214325365477686789676234"))
    }
 
    test("encode nullable big ints") {
 
-      @Serializable
-      data class Test(val b: BigInteger?)
-
-      val schema = Avro.default.schema(Test.serializer())
-      Avro.default.toRecord(Test.serializer(), schema, Test(BigInteger("12312312312321312365477686789676234"))) shouldBe
+      val schema = Avro.default.schema(NullableBigIntegerTest.serializer())
+      Avro.default.toRecord(NullableBigIntegerTest.serializer(), schema, NullableBigIntegerTest(BigInteger("12312312312321312365477686789676234"))) shouldBe
          ListRecord(schema, Utf8("12312312312321312365477686789676234"))
-      Avro.default.toRecord(Test.serializer(), schema, Test(null)) shouldBe ListRecord(schema, null)
+      Avro.default.toRecord(NullableBigIntegerTest.serializer(), schema, NullableBigIntegerTest(null)) shouldBe ListRecord(schema, null)
 
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class BigIntegerTest(val b: BigInteger)
+
+
+   @Serializable
+   data class NullableBigIntegerTest(val b: BigInteger?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ByteArrayEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ByteArrayEncoderTest.kt
index e3fa64c..90bc28b 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ByteArrayEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ByteArrayEncoderTest.kt
@@ -12,15 +12,6 @@ import java.nio.ByteBuffer
 
 class ByteArrayEncoderTest : FunSpec({
 
-   @Serializable
-   data class ByteArrayTest(val z: ByteArray)
-
-   @Serializable
-   data class ArrayByteTest(val z: Array<Byte>)
-
-   @Serializable
-   data class ListByteTest(val z: List<Byte>)
-
    test("encode ByteArray to ByteBuffer to ") {
       val schema = Avro.default.schema(ByteArrayTest.serializer())
       Avro.default.toRecord(ByteArrayTest.serializer(), ByteArrayTest(byteArrayOf(1, 4, 9))) shouldBe
@@ -47,4 +38,14 @@ class ByteArrayEncoderTest : FunSpec({
       val fixed = record.get("z") as GenericFixed
       fixed.bytes() shouldBe byteArrayOf(0, 0, 0, 0, 0, 1, 4, 9)
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class ByteArrayTest(val z: ByteArray)
+
+   @Serializable
+   data class ArrayByteTest(val z: Array<Byte>)
+
+   @Serializable
+   data class ListByteTest(val z: List<Byte>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/DateEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/DateEncoderTest.kt
index 7b8a564..e445504 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/DateEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/DateEncoderTest.kt
@@ -25,83 +25,83 @@ class DateEncoderTest : FunSpec({
 
    test("encode LocalTime as an Int") {
 
-      @Serializable
-      data class Foo(val t: LocalTime)
-
-      val schema = Avro.default.schema(Foo.serializer())
-      Avro.default.toRecord(Foo.serializer(), Foo(LocalTime.of(12, 50, 45))) shouldBe
+      val schema = Avro.default.schema(LocalTimeTest.serializer())
+      Avro.default.toRecord(LocalTimeTest.serializer(), LocalTimeTest(LocalTime.of(12, 50, 45))) shouldBe
          ListRecord(schema, 46245000)
    }
 
    test("encode nullable LocalTime") {
 
-      @Serializable
-      data class Foo(val t: LocalTime?)
-
-      val schema = Avro.default.schema(Foo.serializer())
-      Avro.default.toRecord(Foo.serializer(), Foo(LocalTime.of(12, 50, 45))) shouldBe ListRecord(schema, 46245000)
-      Avro.default.toRecord(Foo.serializer(), Foo(null)) shouldBe ListRecord(schema, null)
+      val schema = Avro.default.schema(NullableLocalTimeTest.serializer())
+      Avro.default.toRecord(NullableLocalTimeTest.serializer(), NullableLocalTimeTest(LocalTime.of(12, 50, 45))) shouldBe ListRecord(schema, 46245000)
+      Avro.default.toRecord(NullableLocalTimeTest.serializer(), NullableLocalTimeTest(null)) shouldBe ListRecord(schema, null)
    }
 
    test("encode LocalDate as an Int") {
 
-      @Serializable
-      data class Foo(val d: LocalDate)
-
-      val schema = Avro.default.schema(Foo.serializer())
-      Avro.default.toRecord(Foo.serializer(), Foo(LocalDate.of(2018, 9, 10))) shouldBe
+      val schema = Avro.default.schema(LocalDateTest.serializer())
+      Avro.default.toRecord(LocalDateTest.serializer(), LocalDateTest(LocalDate.of(2018, 9, 10))) shouldBe
          ListRecord(schema, 17784)
    }
 
    test("encode LocalDateTime as Long") {
 
-      @Serializable
-      data class Foo(val dt: LocalDateTime)
-
-      val schema = Avro.default.schema(Foo.serializer())
-      Avro.default.toRecord(Foo.serializer(), Foo(LocalDateTime.of(2018, 9, 10, 11, 58, 59))) shouldBe
+      val schema = Avro.default.schema(LocalDateTimeTest.serializer())
+      Avro.default.toRecord(LocalDateTimeTest.serializer(), LocalDateTimeTest(LocalDateTime.of(2018, 9, 10, 11, 58, 59))) shouldBe
          ListRecord(schema, 1536580739000L)
    }
 
    test("encode Timestamp as Long") {
 
-      @Serializable
-      data class Foo(val t: Timestamp)
-
-      val schema = Avro.default.schema(Foo.serializer())
-      Avro.default.toRecord(Foo.serializer(), Foo(Timestamp.from(Instant.ofEpochMilli(1538312231000L)))) shouldBe
+      val schema = Avro.default.schema(TimestampTest.serializer())
+      Avro.default.toRecord(TimestampTest.serializer(), TimestampTest(Timestamp.from(Instant.ofEpochMilli(1538312231000L)))) shouldBe
          ListRecord(schema, 1538312231000L)
    }
 
    test("encode nullable Timestamp as Long") {
 
-      @Serializable
-      data class Foo(val t: Timestamp?)
-
-      val schema = Avro.default.schema(Foo.serializer())
-      Avro.default.toRecord(Foo.serializer(), Foo(null)) shouldBe ListRecord(schema, null)
-      Avro.default.toRecord(Foo.serializer(), Foo(Timestamp.from(Instant.ofEpochMilli(1538312231000L)))) shouldBe
+      val schema = Avro.default.schema(NullableTimestampTest.serializer())
+      Avro.default.toRecord(NullableTimestampTest.serializer(), NullableTimestampTest(null)) shouldBe ListRecord(schema, null)
+      Avro.default.toRecord(NullableTimestampTest.serializer(), NullableTimestampTest(Timestamp.from(Instant.ofEpochMilli(1538312231000L)))) shouldBe
          ListRecord(schema, 1538312231000L)
    }
 
    test("encode Instant as Long") {
 
-      @Serializable
-      data class Foo(@Serializable(with = InstantSerializer::class) val i: Instant)
-
-      val schema = Avro.default.schema(Foo.serializer())
-      Avro.default.toRecord(Foo.serializer(), Foo(Instant.ofEpochMilli(1538312231000L))) shouldBe
+      val schema = Avro.default.schema(InstantMillisTest.serializer())
+      Avro.default.toRecord(InstantMillisTest.serializer(), InstantMillisTest(Instant.ofEpochMilli(1538312231000L))) shouldBe
          ListRecord(schema, 1538312231000L)
    }
 
    test("encode Instant with microseconds as Long") {
 
-      @Serializable
-      data class Foo(@Serializable(with = InstantToMicroSerializer::class) val i: Instant)
-
-      val schema = Avro.default.schema(Foo.serializer())
+      val schema = Avro.default.schema(InstantMicrosTest.serializer())
       val time = Instant.ofEpochMilli(1538312231000L).plus(5, ChronoUnit.MICROS)
 
-      Avro.default.toRecord(Foo.serializer(), Foo(time)) shouldBe ListRecord(schema, 1538312231000005L)
+      Avro.default.toRecord(InstantMicrosTest.serializer(), InstantMicrosTest(time)) shouldBe ListRecord(schema, 1538312231000005L)
    }
-})
+}) {
+   @Serializable
+   data class LocalTimeTest(val t: LocalTime)
+
+   @Serializable
+   data class NullableLocalTimeTest(val t: LocalTime?)
+
+   @Serializable
+   data class LocalDateTest(val d: LocalDate)
+
+   @Serializable
+   data class LocalDateTimeTest(val dt: LocalDateTime)
+
+   @Serializable
+   data class TimestampTest(val t: Timestamp)
+
+   @Serializable
+   data class NullableTimestampTest(val t: Timestamp?)
+
+   @Serializable
+   data class InstantMillisTest(@Serializable(with = InstantSerializer::class) val i: Instant)
+
+   @Serializable
+   data class InstantMicrosTest(@Serializable(with = InstantToMicroSerializer::class) val i: Instant)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/FixedEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/FixedEncoderTest.kt
index c9a4fe4..3d84b8e 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/FixedEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/FixedEncoderTest.kt
@@ -16,10 +16,7 @@ class FixedEncoderTest : FunSpec({
          .name("a").type(Schema.createFixed("a", null, null, 5)).noDefault()
          .endRecord()
 
-      @Serializable
-      data class Foo(val s: String)
-
-      val record = Avro.default.toRecord(Foo.serializer(), schema, Foo("hello"))
+      val record = Avro.default.toRecord(StringFoo.serializer(), schema, StringFoo("hello"))
       record[0] shouldBe GenericData.get().createFixed(
          null,
          byteArrayOf(104, 101, 108, 108, 111),
@@ -33,14 +30,17 @@ class FixedEncoderTest : FunSpec({
          .name("a").type(Schema.createFixed("a", null, null, 5)).noDefault()
          .endRecord()
 
-      @Serializable
-      data class Foo(val s: ByteArray)
-
-      val record = Avro.default.toRecord(Foo.serializer(), schema, Foo(byteArrayOf(1, 2, 3, 4, 5)))
+      val record = Avro.default.toRecord(ByteArrayFoo.serializer(), schema, ByteArrayFoo(byteArrayOf(1, 2, 3, 4, 5)))
       record[0] shouldBe GenericData.get().createFixed(
          null,
          byteArrayOf(1, 2, 3, 4, 5),
          Schema.createFixed("a", null, null, 5)
       )
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class StringFoo(val s: String)
+
+   @Serializable
+   data class ByteArrayFoo(val s: ByteArray)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/MapEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/MapEncoderTest.kt
index a88c453..88e2dea 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/MapEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/MapEncoderTest.kt
@@ -11,29 +11,23 @@ import java.nio.ByteBuffer
 class MapEncoderTest : StringSpec({
 
    "encode a Map<String, Boolean>" {
-      @Serializable
-      data class Test(val a: Map<String, Boolean>)
 
-      val schema = Avro.default.schema(Test.serializer())
-      val record = Avro.default.toRecord(Test.serializer(), Test(mapOf("a" to true, "b" to false, "c" to true)))
+      val schema = Avro.default.schema(StringBooleanTest.serializer())
+      val record = Avro.default.toRecord(StringBooleanTest.serializer(), StringBooleanTest(mapOf("a" to true, "b" to false, "c" to true)))
       record shouldBe ListRecord(schema, mapOf(Utf8("a") to true, Utf8("b") to false, Utf8("c") to true))
    }
 
    "encode a Map<String, String>" {
-      @Serializable
-      data class Test(val a: Map<String, String>)
 
-      val schema = Avro.default.schema(Test.serializer())
-      val record = Avro.default.toRecord(Test.serializer(), Test(mapOf("a" to "x", "b" to "y", "c" to "z")))
+      val schema = Avro.default.schema(StringStringTest.serializer())
+      val record = Avro.default.toRecord(StringStringTest.serializer(), StringStringTest(mapOf("a" to "x", "b" to "y", "c" to "z")))
       record shouldBe ListRecord(schema, mapOf(Utf8("a") to Utf8("x"), Utf8("b") to Utf8("y"), Utf8("c") to Utf8("z")))
    }
 
    "encode a Map<String, ByteArray>" {
-      @Serializable
-      data class Test(val a: Map<String, ByteArray>)
 
-      val schema = Avro.default.schema(Test.serializer())
-      val record = Avro.default.toRecord(Test.serializer(), Test(mapOf(
+      val schema = Avro.default.schema(StringByteArrayTest.serializer())
+      val record = Avro.default.toRecord(StringByteArrayTest.serializer(), StringByteArrayTest(mapOf(
          "a" to "x".toByteArray(),
          "b" to "y".toByteArray(),
          "c" to "z".toByteArray()
@@ -47,20 +41,28 @@ class MapEncoderTest : StringSpec({
 
    "encode a Map of records" {
 
-      @Serializable
-      data class Foo(val a: String, val b: Boolean)
-
-      @Serializable
-      data class Test(val a: Map<String, Foo>)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(StringFooTest.serializer())
       val fooSchema = Avro.default.schema(Foo.serializer())
 
-      val record = Avro.default.toRecord(Test.serializer(), Test(mapOf("a" to Foo("x", true), "b" to Foo("y", false))))
+      val record = Avro.default.toRecord(StringFooTest.serializer(), StringFooTest(mapOf("a" to Foo("x", true), "b" to Foo("y", false))))
       val xRecord = ListRecord(fooSchema, Utf8("x"), true)
       val yRecord = ListRecord(fooSchema, Utf8("y"), false)
 
       record shouldBe ListRecord(schema, mapOf(Utf8("a") to xRecord, Utf8("b") to yRecord))
    }
-})
+}) {
+   @Serializable
+   data class StringBooleanTest(val a: Map<String, Boolean>)
+
+   @Serializable
+   data class StringStringTest(val a: Map<String, String>)
+
+   @Serializable
+   data class StringByteArrayTest(val a: Map<String, ByteArray>)
+
+   @Serializable
+   data class Foo(val a: String, val b: Boolean)
 
+   @Serializable
+   data class StringFooTest(val a: Map<String, Foo>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/NamingStrategyEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/NamingStrategyEncoderTest.kt
index 2766e8a..86d1f30 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/NamingStrategyEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/NamingStrategyEncoderTest.kt
@@ -12,9 +12,6 @@ import org.apache.avro.util.Utf8
 
 class NamingStrategyEncoderTest : WordSpec({
    "Encoder" should {
-      @Serializable
-      data class Foo(val fooBar: String)
-
       "support encoding fields with snake_casing" {
          val snakeCaseAvro = Avro(AvroConfiguration(SnakeCaseNamingStrategy))
 
@@ -39,4 +36,7 @@ class NamingStrategyEncoderTest : WordSpec({
          record shouldBe ListRecord(schema, listOf(Utf8("hello")))
       }
    }
-})
+}) {
+   @Serializable
+   data class Foo(val fooBar: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/TransientEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/TransientEncoderTest.kt
index 46312c1..00c328c 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/TransientEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/TransientEncoderTest.kt
@@ -11,11 +11,11 @@ class TransientEncoderTest : FunSpec({
 
    test("encoder should skip @Transient fields") {
 
-      @Serializable
-      data class Test(val a: String, @kotlinx.serialization.Transient val b: String = "foo", val c: String)
-
       val schema = Avro.default.schema(Test.serializer())
       val record = Avro.default.toRecord(Test.serializer(), Test("a", "b", "c"))
       record shouldBe ListRecord(schema, Utf8("a"), Utf8("c"))
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class Test(val a: String, @kotlinx.serialization.Transient val b: String = "foo", val c: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/URLEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/URLEncoderTest.kt
index e1af960..23b4f35 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/URLEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/URLEncoderTest.kt
@@ -16,25 +16,25 @@ class URLEncoderTest : FunSpec({
 
    test("use string for URL") {
 
-      @Serializable
-      data class Test(val b: URL)
+      val schema = Avro.default.schema(UrlTest.serializer())
 
-      val schema = Avro.default.schema(Test.serializer())
+      val test = UrlTest(URL("http://www.sksamuel.com"))
 
-      val test = Test(URL("http://www.sksamuel.com"))
-
-      Avro.default.toRecord(Test.serializer(), schema, test) shouldBe ListRecord(schema, Utf8("http://www.sksamuel.com"))
+      Avro.default.toRecord(UrlTest.serializer(), schema, test) shouldBe ListRecord(schema, Utf8("http://www.sksamuel.com"))
    }
 
    test("encode nullable URLs") {
 
-      @Serializable
-      data class Test(val b: URL?)
-
-      val schema = Avro.default.schema(Test.serializer())
-      Avro.default.toRecord(Test.serializer(), schema, Test(URL("http://www.sksamuel.com"))) shouldBe
+      val schema = Avro.default.schema(NullableUrlTest.serializer())
+      Avro.default.toRecord(NullableUrlTest.serializer(), schema, NullableUrlTest(URL("http://www.sksamuel.com"))) shouldBe
          ListRecord(schema, Utf8("http://www.sksamuel.com"))
-      Avro.default.toRecord(Test.serializer(), schema, Test(null)) shouldBe ListRecord(schema, null)
+      Avro.default.toRecord(NullableUrlTest.serializer(), schema, NullableUrlTest(null)) shouldBe ListRecord(schema, null)
 
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class UrlTest(val b: URL)
+
+   @Serializable
+   data class NullableUrlTest(val b: URL?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/UUIDEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/UUIDEncoderTest.kt
index ad2462d..3ab806b 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/UUIDEncoderTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/UUIDEncoderTest.kt
@@ -16,9 +16,6 @@ class UUIDEncoderTest : FunSpec({
 
    test("encode uuids") {
 
-      @Serializable
-      data class UUIDTest(val uuid: UUID)
-
       val uuid = UUID.randomUUID()
       val schema = Avro.default.schema(UUIDTest.serializer())
       Avro.default.toRecord(UUIDTest.serializer(), UUIDTest(uuid)) shouldBe
@@ -27,9 +24,6 @@ class UUIDEncoderTest : FunSpec({
 
    test("encode lists of uuids") {
 
-      @Serializable
-      data class UUIDList(val uuids: List<UUID>)
-
       val uuid1 = UUID.randomUUID()
       val uuid2 = UUID.randomUUID()
       val schema = Avro.default.schema(UUIDList.serializer())
@@ -40,12 +34,18 @@ class UUIDEncoderTest : FunSpec({
 
    test("encode nullable uuids") {
 
-      @Serializable
-      data class UUIDTest(val uuid: UUID?)
-
       val uuid = UUID.randomUUID()
-      val schema = Avro.default.schema(UUIDTest.serializer())
-      Avro.default.toRecord(UUIDTest.serializer(), UUIDTest(uuid)) shouldBe ListRecord(schema, Utf8(uuid.toString()))
-      Avro.default.toRecord(UUIDTest.serializer(), UUIDTest(null)) shouldBe ListRecord(schema, null)
+      val schema = Avro.default.schema(NullableUUIDTest.serializer())
+      Avro.default.toRecord(NullableUUIDTest.serializer(), NullableUUIDTest(uuid)) shouldBe ListRecord(schema, Utf8(uuid.toString()))
+      Avro.default.toRecord(NullableUUIDTest.serializer(), NullableUUIDTest(null)) shouldBe ListRecord(schema, null)
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class UUIDTest(val uuid: UUID)
+
+   @Serializable
+   data class UUIDList(val uuids: List<UUID>)
+
+   @Serializable
+   data class NullableUUIDTest(val uuid: UUID?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ValueClassEncoderTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ValueClassEncoderTest.kt
new file mode 100644
index 0000000..fb87d7b
--- /dev/null
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/encoder/ValueClassEncoderTest.kt
@@ -0,0 +1,19 @@
+package com.github.avrokotlin.avro4k.encoder
+
+import com.github.avrokotlin.avro4k.Avro
+import com.github.avrokotlin.avro4k.ListRecord
+import com.github.avrokotlin.avro4k.schema.ValueClassSchemaTest
+import io.kotest.core.spec.style.StringSpec
+import io.kotest.matchers.shouldBe
+import org.apache.avro.util.Utf8
+
+class ValueClassEncoderTest : StringSpec({
+
+   "encode value class" {
+
+      val id = ValueClassSchemaTest.StringWrapper("100500")
+      val schema = Avro.default.schema(ValueClassSchemaTest.ContainsInlineTest.serializer())
+      Avro.default.toRecord(ValueClassSchemaTest.ContainsInlineTest.serializer(),
+         ValueClassSchemaTest.ContainsInlineTest(id)) shouldBe ListRecord(schema, Utf8(id.a))
+   }
+})
\ No newline at end of file
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroBinaryOutputStreamTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroBinaryOutputStreamTest.kt
index c123f0f..056807b 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroBinaryOutputStreamTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroBinaryOutputStreamTest.kt
@@ -9,12 +9,6 @@ import java.io.ByteArrayOutputStream
 
 class AvroBinaryOutputStreamTest : StringSpec({
 
-   @Serializable
-   data class Work(val name: String, val year: Int)
-
-   @Serializable
-   data class Composer(val name: String, val birthplace: String, val works: List<Work>)
-
    val ennio = Composer("ennio morricone", "rome", listOf(Work("legend of 1900", 1986), Work("ecstasy of gold", 1969)))
 
    val hans = Composer("hans zimmer", "frankfurt", listOf(Work("batman begins", 2007), Work("dunkirk", 2017)))
@@ -32,4 +26,10 @@ class AvroBinaryOutputStreamTest : StringSpec({
       }
    }
 
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class Work(val name: String, val year: Int)
+
+   @Serializable
+   data class Composer(val name: String, val birthplace: String, val works: List<Work>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroDataOutputStreamCodecTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroDataOutputStreamCodecTest.kt
index 821989a..a9e2b2f 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroDataOutputStreamCodecTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroDataOutputStreamCodecTest.kt
@@ -11,9 +11,6 @@ import java.io.ByteArrayOutputStream
 
 class AvroDataOutputStreamCodecTest : StringSpec({
 
-   @Serializable
-   data class Composer(val name: String, val birthplace: String, val compositions: List<String>)
-
    val ennio = Composer("ennio morricone", "rome", listOf("legend of 1900", "ecstasy of gold"))
 
    "include schema"  {
@@ -56,4 +53,8 @@ class AvroDataOutputStreamCodecTest : StringSpec({
       String(baos.toByteArray()) shouldNot contain("snappy")
    }
 
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class Composer(val name: String, val birthplace: String, val compositions: List<String>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroJsonOutputStreamTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroJsonOutputStreamTest.kt
index ebcf9f5..03dc9d3 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroJsonOutputStreamTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroJsonOutputStreamTest.kt
@@ -9,12 +9,6 @@ import java.io.ByteArrayOutputStream
 
 class AvroJsonOutputStreamTest : StringSpec({
 
-    @Serializable
-    data class Work(val name: String, val year: Int)
-
-    @Serializable
-    data class Composer(val name: String, val birthplace: String, val works: List<Work>)
-
     val ennio = Composer("ennio morricone", "rome", listOf(Work("legend of 1900", 1986), Work("ecstasy of gold", 1969)))
 
     val hans = Composer("hans zimmer", "frankfurt", listOf(Work("batman begins", 2007), Work("dunkirk", 2017)))
@@ -32,4 +26,11 @@ class AvroJsonOutputStreamTest : StringSpec({
         }
     }
 
-})
\ No newline at end of file
+}) {
+
+    @Serializable
+    data class Work(val name: String, val year: Int)
+
+    @Serializable
+    data class Composer(val name: String, val birthplace: String, val works: List<Work>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroNameIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroNameIoTest.kt
index af109da..54acdd1 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroNameIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/AvroNameIoTest.kt
@@ -15,9 +15,6 @@ class AvroNameIoTest : StringSpec({
 
    "using @AvroName to write out a record" {
 
-      @Serializable
-      data class Composer(@AvroName("fullname") val name: String, val status: String)
-
       val ennio = Composer("Ennio Morricone", "Maestro")
 
       // writing out using the schema derived from Compose means fullname should be used
@@ -50,9 +47,6 @@ class AvroNameIoTest : StringSpec({
       val outputStream = Files.newOutputStream(file)
       AvroBinaryOutputStream<GenericRecord>(outputStream, {it}, schema1).write(record).close()
 
-      @Serializable
-      data class Composer(@AvroName("fullname") val name: String, val status: String)
-
       val schema2 = Avro.default.schema(Composer.serializer())
       val input = Avro.default.openInputStream(Composer.serializer()) {
          decodeFormat = AvroDecodeFormat.Binary(
@@ -67,4 +61,8 @@ class AvroNameIoTest : StringSpec({
       Files.delete(file)
    }
 
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class Composer(@AvroName("fullname") val name: String, val status: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/BasicIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/BasicIoTest.kt
index 122219b..52ef703 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/BasicIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/BasicIoTest.kt
@@ -8,28 +8,6 @@ import org.apache.avro.util.Utf8
 
 class BasicIoTest : FunSpec() {
    init {
-
-      @Serializable
-      data class BooleanTest(val z: Boolean)
-
-      @Serializable
-      data class StringTest(val z: String)
-
-      @Serializable
-      data class FloatTest(val z: Float)
-
-      @Serializable
-      data class DoubleTest(val z: Double)
-
-      @Serializable
-      data class IntTest(val z: Int)
-
-      @Serializable
-      data class LongTest(val z: Long)
-
-      @Suppress("ArrayInDataClass")
-      @Serializable
-      data class ByteArrayTest(val z : ByteArray)
       test("read write out booleans") {
          writeRead(BooleanTest(true), BooleanTest.serializer())
          writeRead(BooleanTest(false), BooleanTest.serializer()) {
@@ -73,4 +51,26 @@ class BasicIoTest : FunSpec() {
          }
       }
    }
-}
\ No newline at end of file
+
+   @Serializable
+   data class BooleanTest(val z: Boolean)
+
+   @Serializable
+   data class StringTest(val z: String)
+
+   @Serializable
+   data class FloatTest(val z: Float)
+
+   @Serializable
+   data class DoubleTest(val z: Double)
+
+   @Serializable
+   data class IntTest(val z: Int)
+
+   @Serializable
+   data class LongTest(val z: Long)
+
+   @Suppress("ArrayInDataClass")
+   @Serializable
+   data class ByteArrayTest(val z : ByteArray)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/CollectionsIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/CollectionsIoTest.kt
index fe87abb..ed219d3 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/CollectionsIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/CollectionsIoTest.kt
@@ -20,11 +20,8 @@ class CollectionsIoTest : StringSpec({
 
    "read / write lists of strings" {
 
-      @Serializable
-      data class Test(val a: List<String>, val b: List<String>)
-
-      writeRead(Test(listOf("foo", "boo"), listOf("goo", "moo")), Test.serializer())
-      writeRead(Test(listOf("foo", "boo"), listOf("goo", "moo")), Test.serializer()) {
+      writeRead(StringListsTest(listOf("foo", "boo"), listOf("goo", "moo")), StringListsTest.serializer())
+      writeRead(StringListsTest(listOf("foo", "boo"), listOf("goo", "moo")), StringListsTest.serializer()) {
          it["a"] shouldBe listOf(Utf8("foo"), Utf8("boo"))
          it["b"] shouldBe listOf(Utf8("goo"), Utf8("moo"))
       }
@@ -32,11 +29,8 @@ class CollectionsIoTest : StringSpec({
 
    "read / write sets of booleans" {
 
-      @Serializable
-      data class Test(val a: Set<Boolean>, val b: Set<Boolean>)
-
-      writeRead(Test(setOf(true, false), setOf(false, true)), Test.serializer())
-      writeRead(Test(setOf(true, false), setOf(false, true)), Test.serializer()) {
+      writeRead(BooleanSetsTest(setOf(true, false), setOf(false, true)), BooleanSetsTest.serializer())
+      writeRead(BooleanSetsTest(setOf(true, false), setOf(false, true)), BooleanSetsTest.serializer()) {
          it["a"] shouldBe listOf(true, false)
          it["b"] shouldBe listOf(false, true)
       }
@@ -44,9 +38,6 @@ class CollectionsIoTest : StringSpec({
 
    "read / write sets of ints" {
 
-      @Serializable
-      data class S(val t: Set<Int>)
-
       writeRead(S(setOf(1, 3)), S.serializer())
       writeRead(S(setOf(1, 3)), S.serializer()) {
          (it["t"] as GenericData.Array<Int>).toSet() shouldBe setOf(1, 3)
@@ -55,16 +46,13 @@ class CollectionsIoTest : StringSpec({
 
    "read / write arrays of doubles" {
 
-      @Serializable
-      data class Test(val a: Array<Double>)
-
       // there's a bug in avro with Double.POSINF
       checkAll(
          Arb.positiveDoubles().filter { it < 1000000 },
          Arb.positiveDoubles().filter { it < 1000000 },
          Arb.positiveDoubles().filter { it < 1000000 }
       ) { a, b, c ->
-         writeRead(Test(arrayOf(a, b, c)), Test.serializer()) {
+         writeRead(DoubleArrayTest(arrayOf(a, b, c)), DoubleArrayTest.serializer()) {
             it["a"] shouldBe listOf(a, b, c)
          }
       }
@@ -72,11 +60,8 @@ class CollectionsIoTest : StringSpec({
 
    "read / write lists of long/ints" {
 
-      @Serializable
-      data class Test(val a: List<Long>, val b: List<Int>)
-
       checkAll(Arb.long(), Arb.long(), Arb.int(), Arb.int()) { a, b, c, d ->
-         writeRead(Test(listOf(a, b), listOf(c, d)), Test.serializer()) {
+         writeRead(LongListsTest(listOf(a, b), listOf(c, d)), LongListsTest.serializer()) {
             it["a"] shouldBe listOf(a, b)
             it["b"] shouldBe listOf(c, d)
          }
@@ -85,12 +70,6 @@ class CollectionsIoTest : StringSpec({
 
    "read / write lists of records" {
 
-      @Serializable
-      data class Ingredient(val name: String, val sugar: Double, val fat: Double)
-
-      @Serializable
-      data class Pizza(val name: String, val ingredients: List<Ingredient>, val vegetarian: Boolean, val kcals: Int)
-
       val hawaiian = Pizza("hawaiian", listOf(Ingredient("ham", 1.5, 5.6), Ingredient("pineapple", 5.2, 0.2)), false, 391)
 
       writeRead(hawaiian, Pizza.serializer())
@@ -102,4 +81,25 @@ class CollectionsIoTest : StringSpec({
          (it["ingredients"] as GenericArray<GenericRecord>)[1]["sugar"] shouldBe 5.2
       }
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class StringListsTest(val a: List<String>, val b: List<String>)
+
+   @Serializable
+   data class BooleanSetsTest(val a: Set<Boolean>, val b: Set<Boolean>)
+
+   @Serializable
+   data class S(val t: Set<Int>)
+
+   @Serializable
+   data class LongListsTest(val a: List<Long>, val b: List<Int>)
+
+   @Serializable
+   data class DoubleArrayTest(val a: Array<Double>)
+
+   @Serializable
+   data class Ingredient(val name: String, val sugar: Double, val fat: Double)
+
+   @Serializable
+   data class Pizza(val name: String, val ingredients: List<Ingredient>, val vegetarian: Boolean, val kcals: Int)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/EnumIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/EnumIoTest.kt
index 2a6158b..faf39cc 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/EnumIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/EnumIoTest.kt
@@ -22,9 +22,6 @@ class EnumIoTest : StringSpec({
 
    "read / write enums" {
 
-      @Serializable
-      data class EnumTest(val a: Cream, val b: BBM)
-
       writeRead(EnumTest(Cream.Bruce, BBM.Moore), EnumTest.serializer())
       writeRead(EnumTest(Cream.Bruce, BBM.Moore), EnumTest.serializer()) {
          (it["a"] as GenericEnumSymbol<*>).toString() shouldBe "Bruce"
@@ -34,24 +31,29 @@ class EnumIoTest : StringSpec({
 
    "read / write list of enums" {
 
-      @Serializable
-      data class EnumTest(val a: List<Cream>)
-
-      writeRead(EnumTest(listOf(Cream.Bruce, Cream.Clapton)), EnumTest.serializer())
-      writeRead(EnumTest(listOf(Cream.Bruce, Cream.Clapton)), EnumTest.serializer()) { record ->
+      writeRead(EnumListTest(listOf(Cream.Bruce, Cream.Clapton)), EnumListTest.serializer())
+      writeRead(EnumListTest(listOf(Cream.Bruce, Cream.Clapton)), EnumListTest.serializer()) { record ->
          (record["a"] as List<*>).map { it.toString() } shouldBe listOf("Bruce", "Clapton")
       }
    }
 
    "read / write nullable enums" {
 
-      @Serializable
-      data class EnumTest(val a: Cream?)
-
-      writeRead(EnumTest(null), EnumTest.serializer())
-      writeRead(EnumTest(Cream.Bruce), EnumTest.serializer())
-      writeRead(EnumTest(Cream.Bruce), EnumTest.serializer()) {
+      writeRead(NullableEnumTest(null), NullableEnumTest.serializer())
+      writeRead(NullableEnumTest(Cream.Bruce), NullableEnumTest.serializer())
+      writeRead(NullableEnumTest(Cream.Bruce), NullableEnumTest.serializer()) {
          (it["a"] as GenericData.EnumSymbol).toString() shouldBe "Bruce"
       }
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class EnumTest(val a: Cream, val b: BBM)
+
+   @Serializable
+   data class EnumListTest(val a: List<Cream>)
+
+   @Serializable
+   data class NullableEnumTest(val a: Cream?)
+
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/MapIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/MapIoTest.kt
index 419c967..a8db689 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/MapIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/MapIoTest.kt
@@ -9,9 +9,6 @@ class MapIoTest : StringSpec({
 
    "read/write primitive maps"{
 
-      @Serializable
-      data class Test(val a: Map<String, Boolean>, val b: Map<String, String>, val c: Map<String, Long>)
-
       writeRead(
          Test(
             mapOf("a" to true, "b" to false),
@@ -25,5 +22,8 @@ class MapIoTest : StringSpec({
          it["c"] shouldBe mapOf(Utf8("a") to 123L, Utf8("b") to 999L)
       }
    }
-})
+}) {
 
+   @Serializable
+   data class Test(val a: Map<String, Boolean>, val b: Map<String, String>, val c: Map<String, Long>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/NamingStrategyIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/NamingStrategyIoTest.kt
index f066c0e..ef26d3e 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/NamingStrategyIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/NamingStrategyIoTest.kt
@@ -16,9 +16,6 @@ import java.nio.file.Files
 
 class NamingStrategyIoTest : StringSpec({
 
-   @Serializable
-   data class Composer(val fullName: String, val status: String)
-
    val snakeCaseAvro = Avro(AvroConfiguration(SnakeCaseNamingStrategy))
 
    "using snake_case namingStrategy to write out a record" {
@@ -70,4 +67,7 @@ class NamingStrategyIoTest : StringSpec({
          it.next() shouldBe Composer("Ennio Morricone", "Maestro")
       }
    }
-})
+}) {
+   @Serializable
+   data class Composer(val fullName: String, val status: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/SealedClassIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/SealedClassIoTest.kt
index 5f64bb0..b685746 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/SealedClassIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/SealedClassIoTest.kt
@@ -12,9 +12,6 @@ class SealedClassIoTest : StringSpec({
 
    "read / write sealed class" {
 
-      @Serializable
-      data class SealedClassTest(val a: Operation)
-
       writeRead(SealedClassTest(Operation.Unary.Negate(1)), SealedClassTest.serializer())
       writeRead(SealedClassTest(Operation.Unary.Negate(1)), SealedClassTest.serializer()) {
          val operation = it["a"] as GenericRecord
@@ -25,9 +22,6 @@ class SealedClassIoTest : StringSpec({
 
    "read / write sealed class using object" {
 
-      @Serializable
-      data class SealedClassTest(val a: Operation)
-
       writeRead(SealedClassTest(Operation.Nullary), SealedClassTest.serializer())
       writeRead(SealedClassTest(Operation.Nullary), SealedClassTest.serializer()) {
          val operation = it["a"] as GenericRecord
@@ -37,16 +31,13 @@ class SealedClassIoTest : StringSpec({
 
    "read / write list of sealed class values" {
 
-      @Serializable
-      data class SealedClassTest(val a: List<Operation>)
-
-      val test = SealedClassTest(listOf(
+      val test = SealedClassListTest(listOf(
          Operation.Nullary,
          Operation.Unary.Negate(1),
          Operation.Binary.Add(3,4)
       ))
-      writeRead(test, SealedClassTest.serializer())
-      writeRead(test, SealedClassTest.serializer()) {
+      writeRead(test, SealedClassListTest.serializer())
+      writeRead(test, SealedClassListTest.serializer()) {
          it["a"].shouldBeInstanceOf<List<GenericRecord>>()
          @Suppress("UNCHECKED_CAST")
          val operations = it["a"] as List<GenericRecord>
@@ -63,13 +54,10 @@ class SealedClassIoTest : StringSpec({
 
    "read / write nullable sealed class" {
 
-      @Serializable
-      data class SealedClassTest(val a: Operation?)
-
-      writeRead(SealedClassTest(null), SealedClassTest.serializer())
-      writeRead(SealedClassTest(Operation.Nullary), SealedClassTest.serializer())
-      writeRead(SealedClassTest(Operation.Unary.Negate(1)), SealedClassTest.serializer())
-      writeRead(SealedClassTest(Operation.Unary.Negate(1)), SealedClassTest.serializer()) {
+      writeRead(NullableSealedClassTest(null), NullableSealedClassTest.serializer())
+      writeRead(NullableSealedClassTest(Operation.Nullary), NullableSealedClassTest.serializer())
+      writeRead(NullableSealedClassTest(Operation.Unary.Negate(1)), NullableSealedClassTest.serializer())
+      writeRead(NullableSealedClassTest(Operation.Unary.Negate(1)), NullableSealedClassTest.serializer()) {
          val operation = it["a"] as GenericRecord
          operation.schema shouldBe Avro.default.schema(Operation.Unary.Negate.serializer())
          operation["value"] shouldBe 1
@@ -84,4 +72,14 @@ class SealedClassIoTest : StringSpec({
          operation["value"] shouldBe 1
       }
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class SealedClassTest(val a: Operation)
+
+   @Serializable
+   data class SealedClassListTest(val a: List<Operation>)
+
+   @Serializable
+   data class NullableSealedClassTest(val a: Operation?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/io/UUIDIoTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/io/UUIDIoTest.kt
index 2c2f296..58fa3e8 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/io/UUIDIoTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/io/UUIDIoTest.kt
@@ -17,9 +17,6 @@ class UUIDIoTest : StringSpec({
 
    "read / write UUID" {
 
-      @Serializable
-      data class UUIDTest(val a: UUID)
-
       val uuid = UUID.randomUUID()
 
       writeRead(UUIDTest(uuid), UUIDTest.serializer())
@@ -30,14 +27,11 @@ class UUIDIoTest : StringSpec({
 
    "read / write list of UUIDs" {
 
-      @Serializable
-      data class UUIDTest(val a: List<UUID>)
-
       val uuid1 = UUID.randomUUID()
       val uuid2 = UUID.randomUUID()
 
-      writeRead(UUIDTest(listOf(uuid1, uuid2)), UUIDTest.serializer())
-      writeRead(UUIDTest(listOf(uuid1, uuid2)), UUIDTest.serializer()) {
+      writeRead(UUIDListTest(listOf(uuid1, uuid2)), UUIDListTest.serializer())
+      writeRead(UUIDListTest(listOf(uuid1, uuid2)), UUIDListTest.serializer()) {
          val uuidSchema = SchemaBuilder.builder().stringType()
          LogicalTypes.uuid().addToSchema(uuidSchema)
          val schema = SchemaBuilder.array().items(uuidSchema)
@@ -47,17 +41,24 @@ class UUIDIoTest : StringSpec({
 
    "read / write nullable UUIDs" {
 
-      @Serializable
-      data class UUIDTest(val a: UUID?)
-
       val uuid = UUID.randomUUID()
 
-      writeRead(UUIDTest(uuid), UUIDTest.serializer()) {
+      writeRead(NullableUUIDTest(uuid), NullableUUIDTest.serializer()) {
          it["a"] shouldBe Utf8(uuid.toString())
       }
 
-      writeRead(UUIDTest(null), UUIDTest.serializer()) {
+      writeRead(NullableUUIDTest(null), NullableUUIDTest.serializer()) {
          it["a"] shouldBe null
       }
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class UUIDTest(val a: UUID)
+
+   @Serializable
+   data class UUIDListTest(val a: List<UUID>)
+
+   @Serializable
+   data class NullableUUIDTest(val a: UUID?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ArraySchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ArraySchemaTest.kt
index 64f41e9..9af3683 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ArraySchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ArraySchemaTest.kt
@@ -9,16 +9,12 @@ class ArraySchemaTest : WordSpec({
 
   "SchemaEncoder" should {
     "generate array type for an Array of primitives" {
-      @Serializable
-      data class Test(val array: Array<Boolean>)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/array.json"))
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(BooleanArrayTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "generate array type for a List of primitives" {
-      @Serializable
-      data class NestedListString(val list: List<String>)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/list.json"))
       val schema = Avro.default.schema(NestedListString.serializer())
@@ -26,50 +22,29 @@ class ArraySchemaTest : WordSpec({
     }
     "generate array type for an Array of records" {
 
-      @Serializable
-      data class Nested(val goo: String)
-
-      @Serializable
-      data class Test(val array: Array<Nested>)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/arrayrecords.json"))
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(NestedArrayTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "generate array type for a List of records" {
-      @Serializable
-      data class Nested(val goo: String)
-
-      @Serializable
-      data class Test(val list: List<Nested>)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/listrecords.json"))
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(NestedListTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "generate array type for a Set of records" {
 
-      @Serializable
-      data class Nested(val goo: String)
-
-      @Serializable
-      data class NestedSet(val set: Set<Nested>)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/setrecords.json"))
       val schema = Avro.default.schema(NestedSet.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "generate array type for a Set of strings" {
-      @Serializable
-      data class Test(val set: Set<String>)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/setstrings.json"))
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(StringSetTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "generate array type for a Set of doubles" {
-      @Serializable
-      data class NestedSetDouble(val set: Set<Double>)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/setdoubles.json"))
       val schema = Avro.default.schema(NestedSetDouble.serializer())
@@ -90,4 +65,28 @@ class ArraySchemaTest : WordSpec({
 //    }
   }
 
-})
\ No newline at end of file
+}) {
+  @Serializable
+  data class BooleanArrayTest(val array: Array<Boolean>)
+
+  @Serializable
+  data class Nested(val goo: String)
+
+  @Serializable
+  data class NestedListString(val list: List<String>)
+
+  @Serializable
+  data class NestedArrayTest(val array: Array<Nested>)
+
+  @Serializable
+  data class NestedListTest(val list: List<Nested>)
+
+  @Serializable
+  data class NestedSet(val set: Set<Nested>)
+
+  @Serializable
+  data class StringSetTest(val set: Set<String>)
+
+  @Serializable
+  data class NestedSetDouble(val set: Set<Double>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroAliasSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroAliasSchemaTest.kt
index e31716e..0e30959 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroAliasSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroAliasSchemaTest.kt
@@ -12,42 +12,42 @@ class AvroAliasSchemaTest : WordSpec({
   "SchemaEncoder" should {
     "support alias annotations on types"  {
 
-      @Serializable
-      @AvroAlias("queen")
-      data class Annotated(val str: String)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/aliases_on_types.json"))
-      val schema = Avro.default.schema(Annotated.serializer())
+      val schema = Avro.default.schema(TypeAnnotated.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "support multiple alias annotations on types"  {
 
-      @AvroAliases(["queen","ledzep"])
-      @Serializable
-      data class Annotated(val str: String)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/aliases_on_types_multiple.json"))
-      val schema = Avro.default.schema(Annotated.serializer())
+      val schema = Avro.default.schema(TypeAliasAnnotated.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "support alias annotations on field"  {
 
-      @Serializable
-      data class Annotated(@AvroAlias("cold") val str: String, @AvroAlias("kate") val long: Long, val int: Int)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/aliases_on_fields.json"))
-      val schema = Avro.default.schema(Annotated.serializer())
+      val schema = Avro.default.schema(FieldAnnotated.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
      "support multiple alias annotations on fields"  {
 
-        @Serializable
-        data class Annotated(@AvroAliases(["queen","ledzep"]) val str: String)
-
         val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/aliases_on_fields_multiple.json"))
-        val schema = Avro.default.schema(Annotated.serializer())
+        val schema = Avro.default.schema(FieldAliasAnnotated.serializer())
         schema.toString(true) shouldBe expected.toString(true)
      }
   }
 
-})
\ No newline at end of file
+}) {
+    @Serializable
+    @AvroAlias("queen")
+    data class TypeAnnotated(val str: String)
+
+    @AvroAliases(["queen","ledzep"])
+    @Serializable
+    data class TypeAliasAnnotated(val str: String)
+
+    @Serializable
+    data class FieldAnnotated(@AvroAlias("cold") val str: String, @AvroAlias("kate") val long: Long, val int: Int)
+
+    @Serializable
+    data class FieldAliasAnnotated(@AvroAliases(["queen","ledzep"]) val str: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroDocSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroDocSchemaTest.kt
index 311a6be..da22fdb 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroDocSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroDocSchemaTest.kt
@@ -10,33 +10,36 @@ class AvroDocSchemaTest : WordSpec({
 
   "@AvroDoc" should {
     "support doc annotation on class"  {
-      @AvroDoc("hello; is it me youre looking for")
-      @Serializable
-      data class Annotated(val str: String)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/doc_annotation_class.json"))
-      val schema = Avro.default.schema(Annotated.serializer())
+      val schema = Avro.default.schema(TypeAnnotated.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "support doc annotation on field"  {
-      @Serializable
-      data class Annotated(@AvroDoc("hello its me") val str: String, @AvroDoc("I am a long") val long: Long, val int: Int)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/doc_annotation_field.json"))
-      val schema = Avro.default.schema(Annotated.serializer())
+      val schema = Avro.default.schema(FieldAnnotated.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
     "support doc annotation on nested class"  {
-      @Serializable
-      data class Nested(@AvroDoc("b") val foo: String)
-
-      @Serializable
-      data class Annotated(@AvroDoc("c") val nested: Nested)
 
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/doc_annotation_field_struct.json"))
-      val schema = Avro.default.schema(Annotated.serializer())
+      val schema = Avro.default.schema(NestedAnnotated.serializer())
       schema.toString(true) shouldBe expected.toString(true)
     }
   }
 
-})
\ No newline at end of file
+}) {
+  @AvroDoc("hello; is it me youre looking for")
+  @Serializable
+  data class TypeAnnotated(val str: String)
+
+  @Serializable
+  data class FieldAnnotated(@AvroDoc("hello its me") val str: String, @AvroDoc("I am a long") val long: Long, val int: Int)
+
+  @Serializable
+  data class Nested(@AvroDoc("b") val foo: String)
+
+  @Serializable
+  data class NestedAnnotated(@AvroDoc("c") val nested: Nested)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroFixedSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroFixedSchemaTest.kt
index 74ea19f..98fa36d 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroFixedSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroFixedSchemaTest.kt
@@ -12,9 +12,6 @@ class AvroFixedSchemaTest : WordSpec({
 
       "generated fixed field schema when used on a field"  {
 
-         @Serializable
-         data class FixedStringField(@AvroFixed(7) val mystring: String)
-
          val schema = Avro.default.schema(FixedStringField.serializer())
          val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/fixed_string.json"))
          schema.toString(true) shouldBe expected.toString(true)
@@ -22,20 +19,19 @@ class AvroFixedSchemaTest : WordSpec({
 
       "generated fixed schema when an annotated type is used as the type in a field"  {
 
-         @AvroFixed(8)
-         @Serializable
-         data class FixedClass(val bytes: ByteArray)
-
-         @Serializable
-         data class Foo(val z: FixedClass)
-
          val schema = Avro.default.schema(Foo.serializer())
          val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/fixed_string_value_type_as_field.json"))
          schema.toString(true) shouldBe expected.toString(true)
       }
    }
-})
-
-
+}) {
+   @Serializable
+   data class FixedStringField(@AvroFixed(7) val mystring: String)
 
+   @AvroFixed(8)
+   @Serializable
+   data class FixedClass(val bytes: ByteArray)
 
+   @Serializable
+   data class Foo(val z: FixedClass)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroInlineSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroInlineSchemaTest.kt
index a3eb989..9611524 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroInlineSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroInlineSchemaTest.kt
@@ -10,16 +10,17 @@ class AvroInlineSchemaTest : FunSpec({
 
    test("support @AvroInline") {
 
-      @Serializable
-      @AvroInline
-      data class Name(val value: String)
-
-      @Serializable
-      data class Product(val id: String, val name: Name)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/value_type.json"))
       val schema = Avro.default.schema(Product.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   @AvroInline
+   data class Name(val value: String)
+
+   @Serializable
+   data class Product(val id: String, val name: Name)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNameTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNameTest.kt
index 4b911b8..d857e4b 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNameTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNameTest.kt
@@ -10,23 +10,24 @@ class AvroNameSchemaTest : FunSpec({
 
   test("generate field names using @AvroName") {
 
-    @Serializable
-    data class Foo(@AvroName("foo") val wibble: String, val wobble: String)
-
-    val schema = Avro.default.schema(Foo.serializer())
+    val schema = Avro.default.schema(FieldNamesFoo.serializer())
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/avro_name_field.json"))
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("generate class names using @AvroName") {
 
-    @AvroName("wibble")
-    @Serializable
-    data class Foo(val a: String, val b: String)
-
-    val schema = Avro.default.schema(Foo.serializer())
+    val schema = Avro.default.schema(ClassNameFoo.serializer())
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/avro_name_class.json"))
     schema.toString(true) shouldBe expected.toString(true)
   }
 
-})
\ No newline at end of file
+}) {
+
+  @Serializable
+  data class FieldNamesFoo(@AvroName("foo") val wibble: String, val wobble: String)
+
+  @AvroName("wibble")
+  @Serializable
+  data class ClassNameFoo(val a: String, val b: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNamespaceTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNamespaceTest.kt
index b73c3a3..1ef96fd 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNamespaceTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroNamespaceTest.kt
@@ -1,6 +1,7 @@
 package com.github.avrokotlin.avro4k.schema
 
 import com.github.avrokotlin.avro4k.Avro
+import com.github.avrokotlin.avro4k.AvroName
 import com.github.avrokotlin.avro4k.AvroNamespace
 import io.kotest.matchers.shouldBe
 import io.kotest.core.spec.style.FunSpec
@@ -10,69 +11,75 @@ class AvroNamespaceSchemaTest : FunSpec({
 
    test("support namespace annotations on records") {
 
-      @AvroNamespace("com.yuval")
-      @Serializable
-      data class AnnotatedNamespace(val s: String)
-
       val schema = Avro.default.schema(AnnotatedNamespace.serializer())
       schema.namespace shouldBe "com.yuval"
    }
 
    test("support namespace annotations in nested records") {
 
-      @AvroNamespace("com.yuval.internal")
-      @Serializable
-      data class InternalAnnotated(val i: Int)
-
-      @AvroNamespace("com.yuval")
-      @Serializable
-      data class AnnotatedNamespace(val s: String, val internal: InternalAnnotated)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/namespace.json"))
-      val schema = Avro.default.schema(AnnotatedNamespace.serializer())
+      val schema = Avro.default.schema(NestedAnnotatedNamespace.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
    test("support namespace annotations on field") {
 
-      @Serializable
-      data class InternalAnnotated(val i: Int)
-
-      @Serializable
-      @AvroNamespace("com.yuval")
-      data class AnnotatedNamespace(val s: String,
-                                    @AvroNamespace("com.yuval.internal") val internal: InternalAnnotated)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/namespace.json"))
-      val schema = Avro.default.schema(AnnotatedNamespace.serializer())
+      val schema = Avro.default.schema(InternalAnnotatedNamespace.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
    test("favour namespace annotations on field over record") {
 
-      @Serializable
-      @AvroNamespace("ignore")
-      data class InternalAnnotated(val i: Int)
-
-      @Serializable
-      @AvroNamespace("com.yuval")
-      data class AnnotatedNamespace(val s: String,
-                                    @AvroNamespace("com.yuval.internal") val internal: InternalAnnotated)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/namespace.json"))
-      val schema = Avro.default.schema(AnnotatedNamespace.serializer())
+      val schema = Avro.default.schema(FieldAnnotatedNamespace.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
    test("empty namespace") {
 
-      @AvroNamespace("")
-      @Serializable
-      data class Foo(val s: String)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/namespace_empty.json"))
       val schema = Avro.default.schema(Foo.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
-})
\ No newline at end of file
+}) {
+
+   @AvroNamespace("com.yuval")
+   @Serializable
+   data class AnnotatedNamespace(val s: String)
+
+   @AvroNamespace("com.yuval.internal")
+   @Serializable
+   data class InternalAnnotated(val i: Int)
+
+   @AvroName("AnnotatedNamespace")
+   @AvroNamespace("com.yuval")
+   @Serializable
+   data class NestedAnnotatedNamespace(val s: String, val internal: InternalAnnotated)
+
+   @Serializable
+   @AvroName("InternalAnnotated")
+   data class Internal(val i: Int)
+
+   @Serializable
+   @AvroName("AnnotatedNamespace")
+   @AvroNamespace("com.yuval")
+   data class InternalAnnotatedNamespace(val s: String,
+       @AvroNamespace("com.yuval.internal") val internal: Internal)
+
+   @Serializable
+   @AvroName("InternalAnnotated")
+   @AvroNamespace("ignore")
+   data class InternalIgnoreAnnotated(val i: Int)
+
+   @Serializable
+   @AvroName("AnnotatedNamespace")
+   @AvroNamespace("com.yuval")
+   data class FieldAnnotatedNamespace(val s: String,
+       @AvroNamespace("com.yuval.internal") val internal: InternalIgnoreAnnotated)
+
+   @AvroNamespace("")
+   @Serializable
+   data class Foo(val s: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroPropSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroPropSchemaTest.kt
index f05c53e..8af8075 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroPropSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/AvroPropSchemaTest.kt
@@ -16,35 +16,35 @@ class AvroPropSchemaTest : WordSpec() {
     "@AvroProp" should {
       "support prop annotation on class"  {
 
-        @Serializable
-        @AvroProp("cold", "play")
-        data class Annotated(val str: String)
-
         val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/props_annotation_class.json"))
-        val schema = Avro.default.schema(Annotated.serializer())
+        val schema = Avro.default.schema(TypeAnnotated.serializer())
         schema.toString(true) shouldBe expected.toString(true)
       }
       "support prop annotation on field" {
 
-        @Serializable
-        data class AnnotatedProperties(
-            @AvroProp("cold", "play") val str: String,
-            @AvroProp("kate", "bush") val long: Long,
-            val int: Int)
-
         val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/props_annotation_field.json"))
         val schema = Avro.default.schema(AnnotatedProperties.serializer())
         schema.toString(true) shouldBe expected.toString(true)
       }
       "support props annotations on enums"  {
 
-        @Serializable
-        data class Annotated(@AvroProp("cold", "play") val colours: Colours)
-
         val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/props_annotation_scala_enum.json"))
-        val schema = Avro.default.schema(Annotated.serializer())
+        val schema = Avro.default.schema(EnumAnnotated.serializer())
         schema.toString(true) shouldBe expected.toString(true)
       }
     }
   }
-}
\ No newline at end of file
+
+  @Serializable
+  @AvroProp("cold", "play")
+  data class TypeAnnotated(val str: String)
+
+  @Serializable
+  data class AnnotatedProperties(
+      @AvroProp("cold", "play") val str: String,
+      @AvroProp("kate", "bush") val long: Long,
+      val int: Int)
+
+  @Serializable
+  data class EnumAnnotated(@AvroProp("cold", "play") val colours: Colours)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BasicSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BasicSchemaTest.kt
index cd7c3fa..30f4af8 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BasicSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BasicSchemaTest.kt
@@ -10,12 +10,6 @@ import java.io.File
 
 fun main() {
 
-   @Serializable
-   data class Ingredient(val name: String, val sugar: Double, val fat: Double)
-
-   @Serializable
-   data class Pizza(val name: String, val ingredients: List<Ingredient>, val vegetarian: Boolean, val kcals: Int)
-
    val veg = Pizza("veg", listOf(Ingredient("peppers", 0.1, 0.3), Ingredient("onion", 1.0, 0.4)), true, 265)
    val hawaiian = Pizza("hawaiian", listOf(Ingredient("ham", 1.5, 5.6), Ingredient("pineapple", 5.2, 0.2)), false, 391)
 
@@ -35,6 +29,12 @@ fun main() {
    input.close()
 }
 
+@Serializable
+data class Ingredient(val name: String, val sugar: Double, val fat: Double)
+
+@Serializable
+data class Pizza(val name: String, val ingredients: List<Ingredient>, val vegetarian: Boolean, val kcals: Int)
+
 @Serializable
 data class Nested(val goo: String)
 
@@ -45,17 +45,6 @@ class BasicSchemaTest : FunSpec({
 
   test("schema for basic types") {
 
-    @Serializable
-    data class Foo(val a: String,
-                   val b: Double,
-                   val c: Boolean,
-                   val d: Float,
-                   val e: Long,
-                   val f: Int,
-                   val g: Short,
-                   val h: Byte)
-
-
     val expected = org.apache.avro.Schema.Parser().parse(this::class.java.getResourceAsStream("/basic.json"))
     val schema = Avro.default.schema(Foo.serializer())
     schema.toString(true) shouldBe expected.toString(true)
@@ -69,6 +58,29 @@ class BasicSchemaTest : FunSpec({
 
   test("accept multiple nested case classes") {
 
+    val expected = org.apache.avro.Schema.Parser().parse(this::class.java.getResourceAsStream("/nested_multiple.json"))
+    val schema = Avro.default.schema(Outer.serializer())
+    schema.toString(true) shouldBe expected.toString(true)
+  }
+
+  test("accept deep nested structure") {
+
+    val expected = org.apache.avro.Schema.Parser().parse(this::class.java.getResourceAsStream("/deepnested.json"))
+    val schema = Avro.default.schema(Level1.serializer())
+    schema.toString(true) shouldBe expected.toString(true)
+  }
+}) {
+    @Serializable
+    data class Foo(val a: String,
+        val b: Double,
+        val c: Boolean,
+        val d: Float,
+        val e: Long,
+        val f: Int,
+        val g: Short,
+        val h: Byte)
+
+
     @Serializable
     data class Inner(val goo: String)
 
@@ -78,13 +90,6 @@ class BasicSchemaTest : FunSpec({
     @Serializable
     data class Outer(val middle: Middle)
 
-    val expected = org.apache.avro.Schema.Parser().parse(this::class.java.getResourceAsStream("/nested_multiple.json"))
-    val schema = Avro.default.schema(Outer.serializer())
-    schema.toString(true) shouldBe expected.toString(true)
-  }
-
-  test("accept deep nested structure") {
-
     @Serializable
     data class Level4(val str: String)
 
@@ -96,9 +101,4 @@ class BasicSchemaTest : FunSpec({
 
     @Serializable
     data class Level1(val level2: Level2)
-
-    val expected = org.apache.avro.Schema.Parser().parse(this::class.java.getResourceAsStream("/deepnested.json"))
-    val schema = Avro.default.schema(Level1.serializer())
-    schema.toString(true) shouldBe expected.toString(true)
-  }
-})
\ No newline at end of file
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigDecimalSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigDecimalSchemaTest.kt
index 9ccbb98..b4a834c 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigDecimalSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigDecimalSchemaTest.kt
@@ -15,30 +15,29 @@ class BigDecimalSchemaTest : FunSpec({
 
    test("accept big decimal as logical type on bytes") {
 
-      @Serializable
-      data class Test(val decimal: BigDecimal)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(BigDecimalTest.serializer())
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/bigdecimal.json"))
       schema shouldBe expected
    }
    test("accept big decimal as logical type on bytes with custom scale and precision") {
 
-      @Serializable
-      data class Test(@ScalePrecision(1, 4) val decimal: BigDecimal)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(BigDecimalPrecisionTest.serializer())
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/bigdecimal-scale-and-precision.json"))
       schema shouldBe expected
    }
    test("support nullable BigDecimal as a union") {
 
-      @Serializable
-      data class Test(val decimal: BigDecimal?)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(NullableBigDecimalTest.serializer())
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/bigdecimal_nullable.json"))
       schema shouldBe expected
    }
-})
+}) {
+   @Serializable
+   data class BigDecimalTest(val decimal: BigDecimal)
+
+   @Serializable
+   data class BigDecimalPrecisionTest(@ScalePrecision(1, 4) val decimal: BigDecimal)
 
+   @Serializable
+   data class NullableBigDecimalTest(val decimal: BigDecimal?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigIntegerSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigIntegerSchemaTest.kt
index c303574..a764c19 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigIntegerSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/BigIntegerSchemaTest.kt
@@ -14,9 +14,6 @@ class BigIntegerSchemaTest : FunSpec({
 
    test("accept big integer as String") {
 
-      @Serializable
-      data class Test(val b: BigInteger)
-
       val schema = Avro.default.schema(Test.serializer())
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/bigint.json"))
       schema shouldBe expected
@@ -24,11 +21,14 @@ class BigIntegerSchemaTest : FunSpec({
 
    test("accept nullable big integer as String union") {
 
-      @Serializable
-      data class Test(val b: BigInteger?)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(NullableTest.serializer())
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/bigint_nullable.json"))
       schema shouldBe expected
    }
-})
\ No newline at end of file
+}) {
+   @Serializable
+   data class Test(val b: BigInteger)
+
+   @Serializable
+   data class NullableTest(val b: BigInteger?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ByteArraySchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ByteArraySchemaTest.kt
index b241e7e..f3423b7 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ByteArraySchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ByteArraySchemaTest.kt
@@ -1,6 +1,7 @@
 package com.github.avrokotlin.avro4k.schema
 
 import com.github.avrokotlin.avro4k.Avro
+import com.github.avrokotlin.avro4k.AvroName
 import io.kotest.matchers.shouldBe
 import io.kotest.core.spec.style.FunSpec
 import kotlinx.serialization.Serializable
@@ -8,19 +9,15 @@ import kotlinx.serialization.Serializable
 class ByteArraySchemaTest : FunSpec({
 
   test("encode byte arrays as BYTES type") {
-    @Serializable
-    data class Test(val z: ByteArray)
 
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(ByteArrayTest.serializer())
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/byte_array.json"))
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("encode lists as BYTES type") {
-    @Serializable
-    data class Test(val z: List<Byte>)
 
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(ByteListTest.serializer())
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/byte_array.json"))
     schema.toString(true) shouldBe expected.toString(true)
   }
@@ -47,4 +44,11 @@ class ByteArraySchemaTest : FunSpec({
 //    schema.toString(true) shouldBe expected.toString(true)
 //  }
 
-})
\ No newline at end of file
+}) {
+  @Serializable
+  data class ByteArrayTest(val z: ByteArray)
+
+  @Serializable
+  @AvroName("ByteArrayTest")
+  data class ByteListTest(val z: List<Byte>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ContextualSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ContextualSchemaTest.kt
index 00e4c3e..08a1c49 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ContextualSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ContextualSchemaTest.kt
@@ -17,13 +17,6 @@ import java.time.Instant
 class ContextualSchemaTest : StringSpec({
 
     "schema for contextual serializer" {
-        @Serializable
-        data class Test(
-            @Contextual
-            val ts: Instant,
-            @Contextual
-            val withFallback: Int?,
-        )
 
         val format1 = Avro(
             serializersModule = SerializersModule {
@@ -48,4 +41,12 @@ class ContextualSchemaTest : StringSpec({
         val expected2 = Schema.Parser().parse(javaClass.getResourceAsStream("/contextual_2.json"))
         schema2 shouldBe expected2
     }
-})
+}) {
+    @Serializable
+    data class Test(
+        @Contextual
+        val ts: Instant,
+        @Contextual
+        val withFallback: Int?,
+    )
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/DateSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/DateSchemaTest.kt
index 5d01a80..4638328 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/DateSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/DateSchemaTest.kt
@@ -24,9 +24,6 @@ class DateSchemaTest : FunSpec({
 
    test("generate date logical type for LocalDate") {
 
-      @Serializable
-      data class LocalDateTest(val date: LocalDate)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/localdate.json"))
       val schema = Avro.default.schema(LocalDateTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
@@ -34,19 +31,13 @@ class DateSchemaTest : FunSpec({
 
    test("generate date logical type for nullable LocalDate") {
 
-      @Serializable
-      data class LocalDateTest(val date: LocalDate?)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/localdate_nullable.json"))
-      val schema = Avro.default.schema(LocalDateTest.serializer())
+      val schema = Avro.default.schema(NullableLocalDateTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
    test("generate time logical type for LocalTime") {
 
-      @Serializable
-      data class LocalTimeTest(val time: LocalTime)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/localtime.json"))
       val schema = Avro.default.schema(LocalTimeTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
@@ -54,19 +45,13 @@ class DateSchemaTest : FunSpec({
 
    test("generate time logical type for LocalDateTime") {
 
-      @Serializable
-      data class LocalTimeTest(val time: LocalDateTime)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/localdatetime.json"))
-      val schema = Avro.default.schema(LocalTimeTest.serializer())
+      val schema = Avro.default.schema(LocalDateTimeTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
    test("generate timestamp-millis logical type for Instant") {
 
-      @Serializable
-      data class InstantTest(val instant: Instant)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/instant.json"))
       val schema = Avro.default.schema(InstantTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
@@ -74,9 +59,6 @@ class DateSchemaTest : FunSpec({
 
    test("generate timestamp-millis logical type for Timestamp") {
 
-      @Serializable
-      data class TimestampTest(val ts: Timestamp)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/timestamp.json"))
       val schema = Avro.default.schema(TimestampTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
@@ -84,11 +66,31 @@ class DateSchemaTest : FunSpec({
 
    test("generate timestamp-millis logical type for nullable Timestamp") {
 
-      @Serializable
-      data class Test(val ts: Timestamp?)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/timestamp_nullable.json"))
       val schema = Avro.default.schema(Test.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class LocalDateTest(val date: LocalDate)
+
+   @Serializable
+   data class NullableLocalDateTest(val date: LocalDate?)
+
+   @Serializable
+   data class LocalTimeTest(val time: LocalTime)
+
+   @Serializable
+   data class LocalDateTimeTest(val time: LocalDateTime)
+
+   @Serializable
+   data class InstantTest(val instant: Instant)
+
+
+   @Serializable
+   data class TimestampTest(val ts: Timestamp)
+
+   @Serializable
+   data class Test(val ts: Timestamp?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/EnumSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/EnumSchemaTest.kt
index b8d6157..e594dbf 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/EnumSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/EnumSchemaTest.kt
@@ -15,19 +15,12 @@ class EnumSchemaTest : WordSpec({
    "SchemaEncoder" should {
       "accept enums" {
 
-         @Serializable
-         data class EnumTest(val wine: Wine)
-
          val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/enum.json"))
          val schema = Avro.default.schema(EnumTest.serializer())
          schema.toString(true) shouldBe expected.toString(true)
       }
    }
    "Enum with documentation and aliases" should {
-      @Serializable
-      data class EnumWithDocuTest(
-         val value: Suit
-      )
 
       val expected =
          org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/enum_with_documentation.json"))
@@ -37,10 +30,6 @@ class EnumSchemaTest : WordSpec({
 
    "Enum with default values" should {
       "generate schema" {
-         @Serializable
-         data class EnumWithDefaultTest(
-            val type: IngredientType
-         )
 
          val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/enum_with_default.json"))
 
@@ -49,30 +38,43 @@ class EnumSchemaTest : WordSpec({
          schema.toString(true) shouldBe expected.toString(true)
       }
       "generate schema with default and nullable union types" {
-         @Serializable
-         data class EnumWithDefaultTest(
-            @AvroDefault(Avro.NULL) val type: IngredientType?
-         )
 
          val expected =
             org.apache.avro.Schema.Parser()
                .parse(javaClass.getResourceAsStream("/enum_with_default_value_and_null.json"))
 
-         val schema = Avro.default.schema(EnumWithDefaultTest.serializer())
+         val schema = Avro.default.schema(EnumWithAvroDefaultTest.serializer())
 
          schema.toString(true) shouldBe expected.toString(true)
       }
       "fail with unknown values" {
-         @Serializable
-         data class EnumWithDefaultTest(
-            val type: InvalidIngredientType
-         )
          shouldThrow<IllegalStateException> {
-            Avro.default.schema(EnumWithDefaultTest.serializer())
+            Avro.default.schema(EnumWithUnknownDefaultTest.serializer())
          }
       }
    }
-})
+}) {
+
+   @Serializable
+   data class EnumTest(val wine: Wine)
+   @Serializable
+   data class EnumWithDocuTest(
+       val value: Suit
+   )
+   @Serializable
+   data class EnumWithDefaultTest(
+       val type: IngredientType
+   )
+   @Serializable
+   data class EnumWithAvroDefaultTest(
+       @AvroDefault(Avro.NULL) val type: IngredientType?
+   )
+   @Serializable
+   data class EnumWithUnknownDefaultTest(
+       val type: InvalidIngredientType
+   )
+
+}
 
 enum class Wine {
    Malbec, Shiraz, CabSav, Merlot
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/InlineClassSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/InlineClassSchemaTest.kt
index 6e9bcbb..fa682eb 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/InlineClassSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/InlineClassSchemaTest.kt
@@ -14,16 +14,16 @@ class InlineClassSchemaTest : FunSpec({
 
    test("support inline types") {
 
-      @Serializable
-      @AvroInline
-      data class Name(val value: String)
-
-      @Serializable
-      data class Product(val id: String, val name: Name)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/inline_type.json"))
       val schema = Avro.default.schema(Product.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
-})
\ No newline at end of file
+}) {
+   @Serializable
+   @AvroInline
+   data class Name(val value: String)
+
+   @Serializable
+   data class Product(val id: String, val name: Name)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/MapSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/MapSchemaTest.kt
index 9ce9386..8c77650 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/MapSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/MapSchemaTest.kt
@@ -9,94 +9,98 @@ class MapSchemaTest : FunSpec({
 
   test("generate map type for a Map of strings") {
 
-    @Serializable
-    data class Test(val map: Map<String, String>)
-
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/map_string.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(StringStringTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("generate map type for a Map of ints") {
 
-    @Serializable
-    data class Test(val map: Map<String, Int>)
-
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/map_int.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(StringIntTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("generate map type for a Map of records") {
-    @Serializable
-    data class Nested(val goo: String)
-
-    @Serializable
-    data class Test(val map: Map<String, Nested>)
 
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/map_record.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(StringNestedTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("generate map type for map of nullable booleans") {
-    @Serializable
-    data class Test(val map: Map<String, Boolean?>)
 
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/map_boolean_null.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(StringBooleanTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("support maps of sets of records") {
-    @Serializable
-    data class Nested(val goo: String)
-
-    @Serializable
-    data class Test(val map: Map<String, Set<Nested>>)
 
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/map_set_nested.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(StringSetNestedTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("support array of maps") {
-    @Serializable
-    data class Test(val array: Array<Map<String, String>>)
 
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/array_of_maps.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(ArrayTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("support lists of maps") {
-    @Serializable
-    data class Test(val list: List<Map<String, String>>)
 
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/list_of_maps.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(ListTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("support sets of maps") {
-    @Serializable
-    data class Test(val set: Set<Map<String, String>>)
 
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/set_of_maps.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(SetTest.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
   test("support data class of list of data class with maps") {
-    @Serializable
-    data class Ship(val map: Map<String, String>)
-
-    @Serializable
-    data class Test(val ship: List<Map<String, String>>)
 
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/class_of_list_of_maps.json"))
-    val schema = Avro.default.schema(Test.serializer())
+    val schema = Avro.default.schema(List2Test.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
-})
\ No newline at end of file
+}) {
+  @Serializable
+  data class StringStringTest(val map: Map<String, String>)
+
+  @Serializable
+  data class StringIntTest(val map: Map<String, Int>)
+
+  @Serializable
+  data class Nested(val goo: String)
+
+  @Serializable
+  data class StringNestedTest(val map: Map<String, Nested>)
+
+  @Serializable
+  data class StringBooleanTest(val map: Map<String, Boolean?>)
+
+  @Serializable
+  data class StringSetNestedTest(val map: Map<String, Set<Nested>>)
+
+  @Serializable
+  data class ArrayTest(val array: Array<Map<String, String>>)
+
+  @Serializable
+  data class ListTest(val list: List<Map<String, String>>)
+
+  @Serializable
+  data class SetTest(val set: Set<Map<String, String>>)
+
+  @Serializable
+  data class Ship(val map: Map<String, String>)
+
+  @Serializable
+  data class List2Test(val ship: List<Map<String, String>>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamespaceTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamespaceTest.kt
index 3e1ce7c..94c29eb 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamespaceTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamespaceTest.kt
@@ -22,14 +22,14 @@ class NamespaceSchemaTest : FunSpec() {
 
       test("local classes should use the namespace of their parent object package") {
 
-         @Serializable
-         data class NamespaceTestFoo(val inner: String)
-
          val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/local_class_namespace.json"))
          val schema = Avro.default.schema(NamespaceTestFoo.serializer())
          schema.toString(true) shouldBe expected.toString(true)
       }
    }
+
+   @Serializable
+   data class NamespaceTestFoo(val inner: String)
 }
 
 @Serializable
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamingStrategySchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamingStrategySchemaTest.kt
index 972d4a6..6f296a3 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamingStrategySchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NamingStrategySchemaTest.kt
@@ -8,18 +8,6 @@ import kotlinx.serialization.Serializable
 
 class NamingStrategySchemaTest : WordSpec({
    "NamingStrategy" should {
-      @Serializable
-      data class SubInterface(val name: String, val ipv4Address: String)
-
-      @Serializable
-      data class Interface(
-         val name: String,
-         val ipv4Address: String,
-         val ipv4SubnetMask: Int,
-         val v: InternetProtocol,
-         val subInterface: SubInterface?
-      )
-
       "convert schema with snake_case to camelCase" {
          val snakeCaseAvro = Avro(AvroConfiguration(SnakeCaseNamingStrategy))
 
@@ -40,7 +28,19 @@ class NamingStrategySchemaTest : WordSpec({
          schema.toString(true) shouldBe expected.toString(true)
       }
    }
-})
+}) {
+   @Serializable
+   data class SubInterface(val name: String, val ipv4Address: String)
+
+   @Serializable
+   data class Interface(
+       val name: String,
+       val ipv4Address: String,
+       val ipv4SubnetMask: Int,
+       val v: InternetProtocol,
+       val subInterface: SubInterface?
+   )
+}
 
 @Serializable
 enum class InternetProtocol { IPv4, IPv6 }
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NullableSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NullableSchemaTest.kt
index 28feaec..d3f3355 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NullableSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/NullableSchemaTest.kt
@@ -9,9 +9,6 @@ class NullableSchemaTest : FunSpec({
 
   test("generate null as Union[T, Null]") {
 
-    @Serializable
-    data class Test(val nullableString: String?, val nullableBoolean: Boolean?)
-
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/nullables.json"))
     val schema = Avro.default.schema(Test.serializer())
     schema.toString(true) shouldBe expected.toString(true)
@@ -29,4 +26,7 @@ class NullableSchemaTest : FunSpec({
 //    schema.toString(true) shouldBe expected.toString(true)
 //  }
 
-})
\ No newline at end of file
+}) {
+  @Serializable
+  data class Test(val nullableString: String?, val nullableBoolean: Boolean?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/PairSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/PairSchemaTest.kt
index 9890811..deba738 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/PairSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/PairSchemaTest.kt
@@ -9,26 +9,14 @@ class PairSchemaTest : FunSpec({
 
    test("!generate union:T,U for Pair[T,U] of primitives") {
 
-      @Serializable
-      data class Test(val p: Pair<String, Double>)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/pair.json"))
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(StringDoubleTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
    test("!generate union:T,U for Either[T,U] of records") {
 
-      @Serializable
-      data class Goo(val s: String)
-
-      @Serializable
-      data class Foo(val b: Boolean)
-
-      @Serializable
-      data class Test(val p: Pair<Goo, Foo>)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/pair_records.json"))
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(GooFooTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 //    "generate union:T,U for Either[T,U] of records using @AvroNamespace" in {
@@ -45,4 +33,16 @@ class PairSchemaTest : FunSpec({
 //      AvroSchema[Either[String, Option[Int]]].toString shouldBe """["null","string","int"]"""
 //   }
 
-})
+}) {
+   @Serializable
+   data class StringDoubleTest(val p: Pair<String, Double>)
+
+   @Serializable
+   data class Goo(val s: String)
+
+   @Serializable
+   data class Foo(val b: Boolean)
+
+   @Serializable
+   data class GooFooTest(val p: Pair<Goo, Foo>)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/TransientSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/TransientSchemaTest.kt
index 21a4130..a68cdf2 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/TransientSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/TransientSchemaTest.kt
@@ -9,12 +9,12 @@ class TransientSchemaTest : FunSpec({
 
   test("@AvroTransient fields should be ignored") {
 
-    @Serializable
-    data class TransientFoo(val a: String, @kotlinx.serialization.Transient val b: String = "foo", val c: String)
-
     val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/transient.json"))
     val schema = Avro.default.schema(TransientFoo.serializer())
     schema.toString(true) shouldBe expected.toString(true)
   }
 
-})
\ No newline at end of file
+}) {
+  @Serializable
+  data class TransientFoo(val a: String, @kotlinx.serialization.Transient val b: String = "foo", val c: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/URLSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/URLSchemaTest.kt
index 335d62a..83d56f9 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/URLSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/URLSchemaTest.kt
@@ -14,9 +14,6 @@ class URLSchemaTest : FunSpec({
 
    test("accept URL as String") {
 
-      @Serializable
-      data class Test(val b: URL)
-
       val schema = Avro.default.schema(Test.serializer())
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/url.json"))
       schema shouldBe expected
@@ -24,11 +21,15 @@ class URLSchemaTest : FunSpec({
 
    test("accept nullable URL as String union") {
 
-      @Serializable
-      data class Test(val b: URL?)
-
-      val schema = Avro.default.schema(Test.serializer())
+      val schema = Avro.default.schema(NullableTest.serializer())
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/url_nullable.json"))
       schema shouldBe expected
    }
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class Test(val b: URL)
+
+   @Serializable
+   data class NullableTest(val b: URL?)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UUIDSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UUIDSchemaTest.kt
index 775332d..cbf78fd 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UUIDSchemaTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UUIDSchemaTest.kt
@@ -14,12 +14,13 @@ class UUIDSchemaTest : FunSpec({
 
    test("support UUID logical types") {
 
-      @Serializable
-      data class UUIDTest(val uuid: UUID)
-
       val expected = org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/uuid.json"))
       val schema = Avro.default.schema(UUIDTest.serializer())
       schema.toString(true) shouldBe expected.toString(true)
    }
 
-})
\ No newline at end of file
+}) {
+
+   @Serializable
+   data class UUIDTest(val uuid: UUID)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UserDefinedSerializerTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UserDefinedSerializerTest.kt
index 1bfd616..a191a3e 100644
--- a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UserDefinedSerializerTest.kt
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/UserDefinedSerializerTest.kt
@@ -19,30 +19,6 @@ class UserDefinedSerializerTest : FunSpec({
 
    test("schema from user-defined-serializer") {
 
-      @Serializer(forClass = String::class)
-      @OptIn(ExperimentalSerializationApi::class)
-      class StringAsFixedSerializer : AvroSerializer<String>() {
-
-         override fun encodeAvroValue(schema: Schema, encoder: ExtendedEncoder, obj: String) {
-            TODO()
-         }
-
-         override fun decodeAvroValue(schema: Schema, decoder: ExtendedDecoder): String {
-            TODO()
-         }
-
-         override val descriptor: SerialDescriptor = object : AvroDescriptor("fixed-string", PrimitiveKind.STRING) {
-            override fun schema(annos: List<Annotation>,
-                                serializersModule: SerializersModule,
-                                namingStrategy: NamingStrategy): Schema {
-               return Schema.createFixed("foo", null, null, 10)
-            }
-         }
-      }
-
-      @Serializable
-      data class Test(@Serializable(with = StringAsFixedSerializer::class) val fixed: String)
-
       Avro.default.schema(Test.serializer()) shouldBe
          SchemaBuilder.record("Test")
             .namespace("com.github.avrokotlin.avro4k.schema.UserDefinedSerializerTest")
@@ -50,4 +26,28 @@ class UserDefinedSerializerTest : FunSpec({
             .name("fixed").type(Schema.createFixed("foo", null, null, 10)).noDefault()
             .endRecord()
    }
-})
\ No newline at end of file
+}) {
+   @Serializer(forClass = String::class)
+   @OptIn(ExperimentalSerializationApi::class)
+   class StringAsFixedSerializer : AvroSerializer<String>() {
+
+      override fun encodeAvroValue(schema: Schema, encoder: ExtendedEncoder, obj: String) {
+         TODO()
+      }
+
+      override fun decodeAvroValue(schema: Schema, decoder: ExtendedDecoder): String {
+         TODO()
+      }
+
+      override val descriptor: SerialDescriptor = object : AvroDescriptor("fixed-string", PrimitiveKind.STRING) {
+         override fun schema(annos: List<Annotation>,
+             serializersModule: SerializersModule,
+             namingStrategy: NamingStrategy): Schema {
+            return Schema.createFixed("foo", null, null, 10)
+         }
+      }
+   }
+
+   @Serializable
+   data class Test(@Serializable(with = StringAsFixedSerializer::class) val fixed: String)
+}
diff --git a/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ValueClassSchemaTest.kt b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ValueClassSchemaTest.kt
new file mode 100644
index 0000000..925626b
--- /dev/null
+++ b/src/test/kotlin/com/github/avrokotlin/avro4k/schema/ValueClassSchemaTest.kt
@@ -0,0 +1,23 @@
+package com.github.avrokotlin.avro4k.schema
+
+import com.github.avrokotlin.avro4k.Avro
+import io.kotest.core.spec.style.StringSpec
+import io.kotest.matchers.shouldBe
+import kotlinx.serialization.Serializable
+
+class ValueClassSchemaTest : StringSpec({
+
+   "value class should be primitive in schema" {
+      val expected =
+         org.apache.avro.Schema.Parser().parse(javaClass.getResourceAsStream("/value_class.json"))
+      val schema = Avro.default.schema(ContainsInlineTest.serializer())
+      schema.toString(true) shouldBe expected.toString(true)
+   }
+}) {
+   @Serializable
+   @JvmInline
+   value class StringWrapper(val a: String)
+
+   @Serializable
+   data class ContainsInlineTest(val id: StringWrapper)
+}
\ No newline at end of file
diff --git a/src/test/resources/aliases_on_fields.json b/src/test/resources/aliases_on_fields.json
index 387542d..0fc332d 100644
--- a/src/test/resources/aliases_on_fields.json
+++ b/src/test/resources/aliases_on_fields.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "Annotated",
+   "name": "FieldAnnotated",
    "namespace": "com.github.avrokotlin.avro4k.schema.AvroAliasSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/aliases_on_fields_multiple.json b/src/test/resources/aliases_on_fields_multiple.json
index 3fbf0d3..0a4409e 100644
--- a/src/test/resources/aliases_on_fields_multiple.json
+++ b/src/test/resources/aliases_on_fields_multiple.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "FieldAliasAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroAliasSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/aliases_on_types.json b/src/test/resources/aliases_on_types.json
index 8bf6b86..a17ef51 100644
--- a/src/test/resources/aliases_on_types.json
+++ b/src/test/resources/aliases_on_types.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "TypeAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroAliasSchemaTest",
   "aliases": [
     "queen"
diff --git a/src/test/resources/aliases_on_types_multiple.json b/src/test/resources/aliases_on_types_multiple.json
index 98373aa..8e2d141 100644
--- a/src/test/resources/aliases_on_types_multiple.json
+++ b/src/test/resources/aliases_on_types_multiple.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "TypeAliasAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroAliasSchemaTest",
   "aliases": [
     "queen",
diff --git a/src/test/resources/array.json b/src/test/resources/array.json
index 06a5178..8ce9d77 100644
--- a/src/test/resources/array.json
+++ b/src/test/resources/array.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "BooleanArrayTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.ArraySchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/array_of_maps.json b/src/test/resources/array_of_maps.json
index 3befd8b..dcb6d0b 100644
--- a/src/test/resources/array_of_maps.json
+++ b/src/test/resources/array_of_maps.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "ArrayTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/arrayrecords.json b/src/test/resources/arrayrecords.json
index cfd57d0..c196827 100644
--- a/src/test/resources/arrayrecords.json
+++ b/src/test/resources/arrayrecords.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "NestedArrayTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.ArraySchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/avro_name_field.json b/src/test/resources/avro_name_field.json
index 7985941..40c7560 100644
--- a/src/test/resources/avro_name_field.json
+++ b/src/test/resources/avro_name_field.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Foo",
+  "name": "FieldNamesFoo",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroNameSchemaTest",
   "fields": [
     {
@@ -12,4 +12,4 @@
       "type": "string"
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/bigdecimal-scale-and-precision.json b/src/test/resources/bigdecimal-scale-and-precision.json
index 641ca0c..4cf0763 100644
--- a/src/test/resources/bigdecimal-scale-and-precision.json
+++ b/src/test/resources/bigdecimal-scale-and-precision.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "Test",
+   "name": "BigDecimalPrecisionTest",
    "namespace": "com.github.avrokotlin.avro4k.schema.BigDecimalSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/bigdecimal.json b/src/test/resources/bigdecimal.json
index 8c39707..c3d6126 100644
--- a/src/test/resources/bigdecimal.json
+++ b/src/test/resources/bigdecimal.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "BigDecimalTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.BigDecimalSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/bigdecimal_nullable.json b/src/test/resources/bigdecimal_nullable.json
index f608356..df1fb04 100644
--- a/src/test/resources/bigdecimal_nullable.json
+++ b/src/test/resources/bigdecimal_nullable.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "Test",
+   "name": "NullableBigDecimalTest",
    "namespace": "com.github.avrokotlin.avro4k.schema.BigDecimalSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/bigint_nullable.json b/src/test/resources/bigint_nullable.json
index 993e905..20539fe 100644
--- a/src/test/resources/bigint_nullable.json
+++ b/src/test/resources/bigint_nullable.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "Test",
+   "name": "NullableTest",
    "namespace": "com.github.avrokotlin.avro4k.schema.BigIntegerSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/byte_array.json b/src/test/resources/byte_array.json
index 2794eee..15e80c9 100644
--- a/src/test/resources/byte_array.json
+++ b/src/test/resources/byte_array.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "ByteArrayTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.ByteArraySchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/class_of_list_of_maps.json b/src/test/resources/class_of_list_of_maps.json
index 7439bed..ec509ca 100644
--- a/src/test/resources/class_of_list_of_maps.json
+++ b/src/test/resources/class_of_list_of_maps.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "List2Test",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
@@ -14,4 +14,4 @@
       }
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/doc_annotation_class.json b/src/test/resources/doc_annotation_class.json
index 6136277..a1a6fe5 100644
--- a/src/test/resources/doc_annotation_class.json
+++ b/src/test/resources/doc_annotation_class.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "TypeAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroDocSchemaTest",
   "doc" : "hello; is it me youre looking for",
   "fields": [
diff --git a/src/test/resources/doc_annotation_field.json b/src/test/resources/doc_annotation_field.json
index 853b364..2e23236 100644
--- a/src/test/resources/doc_annotation_field.json
+++ b/src/test/resources/doc_annotation_field.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "FieldAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroDocSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/doc_annotation_field_struct.json b/src/test/resources/doc_annotation_field_struct.json
index 9d4529a..d26ea98 100644
--- a/src/test/resources/doc_annotation_field_struct.json
+++ b/src/test/resources/doc_annotation_field_struct.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "NestedAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroDocSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/enum_with_default_value_and_null.json b/src/test/resources/enum_with_default_value_and_null.json
index 188187b..49710c2 100644
--- a/src/test/resources/enum_with_default_value_and_null.json
+++ b/src/test/resources/enum_with_default_value_and_null.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "EnumWithDefaultTest",
+   "name": "EnumWithAvroDefaultTest",
    "namespace": "com.github.avrokotlin.avro4k.schema.EnumSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/list_of_maps.json b/src/test/resources/list_of_maps.json
index 45b2dc8..c9fae03 100644
--- a/src/test/resources/list_of_maps.json
+++ b/src/test/resources/list_of_maps.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "ListTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/listrecords.json b/src/test/resources/listrecords.json
index e0ec12c..64907f9 100644
--- a/src/test/resources/listrecords.json
+++ b/src/test/resources/listrecords.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "NestedListTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.ArraySchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/localdate_nullable.json b/src/test/resources/localdate_nullable.json
index 38a4560..759e340 100644
--- a/src/test/resources/localdate_nullable.json
+++ b/src/test/resources/localdate_nullable.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "LocalDateTest",
+   "name": "NullableLocalDateTest",
    "namespace": "com.github.avrokotlin.avro4k.schema.DateSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/localdatetime.json b/src/test/resources/localdatetime.json
index a04641a..f928854 100644
--- a/src/test/resources/localdatetime.json
+++ b/src/test/resources/localdatetime.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "LocalTimeTest",
+   "name": "LocalDateTimeTest",
    "namespace": "com.github.avrokotlin.avro4k.schema.DateSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/map_boolean_null.json b/src/test/resources/map_boolean_null.json
index 7b66435..91bef6d 100644
--- a/src/test/resources/map_boolean_null.json
+++ b/src/test/resources/map_boolean_null.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "StringBooleanTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/map_int.json b/src/test/resources/map_int.json
index 0da4a25..03ccba4 100644
--- a/src/test/resources/map_int.json
+++ b/src/test/resources/map_int.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "StringIntTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/map_record.json b/src/test/resources/map_record.json
index 9564d8f..406c16c 100644
--- a/src/test/resources/map_record.json
+++ b/src/test/resources/map_record.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "StringNestedTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/map_set_nested.json b/src/test/resources/map_set_nested.json
index 4ad67fe..ecaebd4 100644
--- a/src/test/resources/map_set_nested.json
+++ b/src/test/resources/map_set_nested.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "StringSetNestedTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/map_string.json b/src/test/resources/map_string.json
index 8a30e41..790ae67 100644
--- a/src/test/resources/map_string.json
+++ b/src/test/resources/map_string.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "StringStringTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/namespace.json b/src/test/resources/namespace.json
index 760b6b4..e7ad951 100644
--- a/src/test/resources/namespace.json
+++ b/src/test/resources/namespace.json
@@ -22,4 +22,4 @@
          }
       }
    ]
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/props_annotation_class.json b/src/test/resources/props_annotation_class.json
index 353db5a..06abad6 100644
--- a/src/test/resources/props_annotation_class.json
+++ b/src/test/resources/props_annotation_class.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "TypeAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroPropSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/props_annotation_scala_enum.json b/src/test/resources/props_annotation_scala_enum.json
index bda45b0..af07e5b 100644
--- a/src/test/resources/props_annotation_scala_enum.json
+++ b/src/test/resources/props_annotation_scala_enum.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Annotated",
+  "name": "EnumAnnotated",
   "namespace": "com.github.avrokotlin.avro4k.schema.AvroPropSchemaTest",
   "fields": [
     {
@@ -17,4 +17,4 @@
       "cold": "play"
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/set_of_maps.json b/src/test/resources/set_of_maps.json
index f98b015..141788a 100644
--- a/src/test/resources/set_of_maps.json
+++ b/src/test/resources/set_of_maps.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "SetTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.MapSchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/setstrings.json b/src/test/resources/setstrings.json
index 758ed86..11bb9e8 100644
--- a/src/test/resources/setstrings.json
+++ b/src/test/resources/setstrings.json
@@ -1,6 +1,6 @@
 {
   "type": "record",
-  "name": "Test",
+  "name": "StringSetTest",
   "namespace": "com.github.avrokotlin.avro4k.schema.ArraySchemaTest",
   "fields": [
     {
diff --git a/src/test/resources/url_nullable.json b/src/test/resources/url_nullable.json
index 0c97caf..14efac5 100644
--- a/src/test/resources/url_nullable.json
+++ b/src/test/resources/url_nullable.json
@@ -1,6 +1,6 @@
 {
    "type": "record",
-   "name": "Test",
+   "name": "NullableTest",
    "namespace": "com.github.avrokotlin.avro4k.schema.URLSchemaTest",
    "fields": [
       {
diff --git a/src/test/resources/value_class.json b/src/test/resources/value_class.json
new file mode 100644
index 0000000..5097658
--- /dev/null
+++ b/src/test/resources/value_class.json
@@ -0,0 +1,11 @@
+{
+   "type": "record",
+   "name": "ContainsInlineTest",
+   "namespace": "com.github.avrokotlin.avro4k.schema.ValueClassSchemaTest",
+   "fields": [
+      {
+         "name": "id",
+         "type": "string"
+      }
+   ]
+}