Skip to content

Commit

Permalink
Add new test for the invalid variable name usage
Browse files Browse the repository at this point in the history
  • Loading branch information
theEvilReaper committed Dec 14, 2024
1 parent c768069 commit 728cb52
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ import net.theevilreaper.dartpoet.type.TypeName
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.ValueSource

@DisplayName("Test each method from the StringHelper utility class")
class StringHelperTest {

@ParameterizedTest(name = "Test if the given variable name {0} is invalid")
@ValueSource(strings = ["", " "])
fun `test if empty variable name throws exception`(input: String) {
assertThrowsExactly<IllegalArgumentException>(
IllegalArgumentException::class.java,
{ StringHelper.ensureVariableNameWithPrivateModifier(input, true) },
"The name parameter can't be empty"
)
}

@Test
fun `test modifier concatenation`() {
val modifiers = setOf(DartModifier.CONST, DartModifier.FINAL, DartModifier.FACTORY)
Expand Down

0 comments on commit 728cb52

Please sign in to comment.