Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
theEvilReaper committed Jan 12, 2024
1 parent 15041fe commit 5999e28
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.theevilreaper.dartpoet.enumeration

import com.google.common.truth.Truth
import net.theevilreaper.dartpoet.enum.EnumPropertySpec
import net.theevilreaper.dartpoet.type.ClassName
import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
Expand All @@ -27,6 +28,12 @@ class EnumPropertySpecTest {
"navigation('/dashboard')"
)
)

@JvmStatic
private fun genericEnumProperties(): Stream<Arguments> = Stream.of(
Arguments.of(EnumPropertySpec.builder("test").generic(String::class).build(), "test<String>"),
Arguments.of(EnumPropertySpec.builder("test").generic(ClassName("E")).build(), "test<E>"),
)
}

@ParameterizedTest
Expand All @@ -35,6 +42,12 @@ class EnumPropertySpecTest {
Truth.assertThat(spec.toString()).isEqualTo(excepted)
}

@ParameterizedTest
@MethodSource("genericEnumProperties")
fun `test generic enum property generation`(spec: EnumPropertySpec, excepted: String) {
Truth.assertThat(spec.toString()).isEqualTo(excepted)
}

@Test
fun `test spec conversion to a builder`() {
val propertySpec = EnumPropertySpec
Expand Down

0 comments on commit 5999e28

Please sign in to comment.