diff --git a/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/V6.groovy b/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/V6.groovy index 71d08c24e49..fc68745203f 100644 --- a/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/V6.groovy +++ b/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/V6.groovy @@ -3,6 +3,6 @@ package io.micronaut.docs.inject.generics // tag::class[] class V6 implements CylinderProvider { @Override - int getCylinders() { 7 } + int getCylinders() { 6 } } // end::class[] diff --git a/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/VehicleSpec.groovy b/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/VehicleSpec.groovy index 386e8f60617..68264b990aa 100644 --- a/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/VehicleSpec.groovy +++ b/test-suite-groovy/src/test/groovy/io/micronaut/docs/inject/generics/VehicleSpec.groovy @@ -12,5 +12,6 @@ class VehicleSpec extends Specification { void 'test start engine'() { expect: vehicle.start() == 'Starting V8' + [6] == vehicle.v6Engines.collect {engine -> engine.cylinders } } } diff --git a/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/V6.kt b/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/V6.kt index b7a8d10528d..2902c797ecc 100644 --- a/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/V6.kt +++ b/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/V6.kt @@ -2,6 +2,6 @@ package io.micronaut.docs.inject.generics // tag::class[] class V6 : CylinderProvider { - override val cylinders: Int = 7 + override val cylinders: Int = 6 } -// end::class[] \ No newline at end of file +// end::class[] diff --git a/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/VehicleSpec.kt b/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/VehicleSpec.kt index 3f034b7c458..a39561b1c5a 100644 --- a/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/VehicleSpec.kt +++ b/test-suite-kotlin/src/test/kotlin/io/micronaut/docs/inject/generics/VehicleSpec.kt @@ -9,5 +9,7 @@ class VehicleSpec(private val vehicle: Vehicle) { @Test fun testStartVehicle() { assertEquals("Starting V8", vehicle.start()) + assertEquals(listOf(6), vehicle.v6Engines + .map { it.cylinders }) } -} \ No newline at end of file +} diff --git a/test-suite/src/test/java/io/micronaut/docs/inject/generics/V6.java b/test-suite/src/test/java/io/micronaut/docs/inject/generics/V6.java index ebe5c3fcbf2..4aa031cc573 100644 --- a/test-suite/src/test/java/io/micronaut/docs/inject/generics/V6.java +++ b/test-suite/src/test/java/io/micronaut/docs/inject/generics/V6.java @@ -4,7 +4,7 @@ public class V6 implements CylinderProvider { @Override public int getCylinders() { - return 7; + return 6; } } // end::class[] diff --git a/test-suite/src/test/java/io/micronaut/docs/inject/generics/VehicleSpec.java b/test-suite/src/test/java/io/micronaut/docs/inject/generics/VehicleSpec.java index 5626029a9a0..7a0252f0614 100644 --- a/test-suite/src/test/java/io/micronaut/docs/inject/generics/VehicleSpec.java +++ b/test-suite/src/test/java/io/micronaut/docs/inject/generics/VehicleSpec.java @@ -2,6 +2,10 @@ import io.micronaut.test.extensions.junit5.annotation.MicronautTest; import org.junit.jupiter.api.Test; + +import java.util.Collections; +import java.util.stream.Collectors; + import static org.junit.jupiter.api.Assertions.assertEquals; @@ -16,6 +20,10 @@ public VehicleSpec(Vehicle vehicle) { @Test public void testStartVehicle() { assertEquals("Starting V8", vehicle.start()); + assertEquals(Collections.singletonList(6), vehicle.v6Engines + .stream() + .map(Engine::getCylinders) + .collect(Collectors.toList())); } -} \ No newline at end of file +}