-
Notifications
You must be signed in to change notification settings - Fork 0
/
DecodeStringTest.kt
28 lines (24 loc) · 1 KB
/
DecodeStringTest.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package ru.romanow
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.extension.ExtensionContext
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.Arguments
import org.junit.jupiter.params.provider.ArgumentsProvider
import org.junit.jupiter.params.provider.ArgumentsSource
import java.util.stream.Stream
class DecodeStringTest {
@ArgumentsSource(ValueProvider::class)
@ParameterizedTest(name = "#{index} – Decoding string {0} is {1}")
fun decodeString(s: String, result: String) {
val obj = DecodeString()
assertThat(obj.decodeString(s)).isEqualTo(result)
}
internal class ValueProvider : ArgumentsProvider {
override fun provideArguments(context: ExtensionContext): Stream<Arguments> =
Stream.of(
Arguments.of("3[a]2[bc]", "aaabcbc"),
Arguments.of("3[a2[c]]", "accaccacc"),
Arguments.of("2[abc]3[cd]ef", "abcabccdcdcdef")
)
}
}