Skip to content

Commit

Permalink
✅ Update tests of EmailAddress.Companion.fromStringOrNull (#635)
Browse files Browse the repository at this point in the history
Updates code samples tests of this function.
  • Loading branch information
LVMVRQUXL committed Mar 31, 2024
1 parent 7c23ae3 commit ff0ca8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ void patternSample_should_pass() {
void fromStringOrNullSample_should_pass() {
final EmailAddressCompanionJavaSample sample =
new EmailAddressCompanionJavaSample();
final String actual = Assertions.assertDoesNotThrow(
final String output = Assertions.assertDoesNotThrow(
() -> SystemLambda.tapSystemOut(sample::fromStringOrNullSample)
).trim();
final String expected = "true";
Assertions.assertEquals(expected, actual);
final boolean actual = Boolean.parseBoolean(output);
Assertions.assertTrue(actual);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.kotools.types
import com.github.stefanbirkner.systemlambda.SystemLambda
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue

class EmailAddressCompanionKotlinSampleTest {
@Test
Expand All @@ -16,10 +17,12 @@ class EmailAddressCompanionKotlinSampleTest {

@Test
fun fromStringOrNullSample_should_pass() {
val actual: String = SystemLambda.tapSystemOut(
EmailAddressCompanionKotlinSample::fromStringOrNullSample
).trim()
val expected = "true"
assertEquals(expected, actual)
val actual: Boolean = SystemLambda
.tapSystemOut(
EmailAddressCompanionKotlinSample::fromStringOrNullSample
)
.trim()
.toBooleanStrict()
assertTrue(actual)
}
}

0 comments on commit ff0ca8c

Please sign in to comment.