|
| 1 | +/* |
| 2 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | + * you may not use this file except in compliance with the License. |
| 4 | + * You may obtain a copy of the License at |
| 5 | + * |
| 6 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + * |
| 8 | + * Unless required by applicable law or agreed to in writing, software |
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | + * See the License for the specific language governing permissions and |
| 12 | + * limitations under the License. |
| 13 | + */ |
| 14 | +package wvlet.airframe.surface |
| 15 | + |
| 16 | +import wvlet.airspec.AirSpec |
| 17 | + |
| 18 | +/** |
| 19 | + * Test generic types with default values |
| 20 | + */ |
| 21 | +object i3353 extends AirSpec: |
| 22 | + case class FValue[V](value: Option[Int] = None) |
| 23 | + |
| 24 | + test("With an optional value default argument") { |
| 25 | + Surface.of[FValue[Int]] |
| 26 | + } |
| 27 | + |
| 28 | + case class MValue[T](value: Seq[T] = Seq.empty) |
| 29 | + |
| 30 | + test("With a default value of a Seq type") { |
| 31 | + Surface.of[MValue[Int]] |
| 32 | + } |
| 33 | + |
| 34 | + case class NValue[T >: Null](value: T = null) |
| 35 | + |
| 36 | + test("With a default value of a generic type") { |
| 37 | + Surface.of[NValue[String]] |
| 38 | + } |
| 39 | + |
| 40 | + case class BValue[T](value: T, boolean: Boolean = false) |
| 41 | + |
| 42 | + test("With a default value of a generic type and regular arg") { |
| 43 | + Surface.of[BValue[String]] |
| 44 | + } |
| 45 | + |
| 46 | + case class ZValue[T](boolean: Boolean = false) |
| 47 | + |
| 48 | + test("With a default value of a boolean type") { |
| 49 | + Surface.of[ZValue[String]] |
| 50 | + } |
0 commit comments