Skip to content

Commit

Permalink
♻️ Refactor EmailAddress.Companion.fromStringOrNull(Any, Any)
Browse files Browse the repository at this point in the history
Ref: #635
  • Loading branch information
LVMVRQUXL committed Mar 31, 2024
1 parent e5118da commit 96007a6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/commonMain/kotlin/org/kotools/types/EmailAddress.kt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public class EmailAddress private constructor() {
*
* Here's an example of calling this function from Kotlin code:
*
* SAMPLE: EmailAddressCompanionKotlinSample.fromStringOrNull_Any_Any_Sample.md
* SAMPLE: EmailAddressCompanionKotlinSample.fromStringOrNull_Any_Any.md
* </details>
*
* <br>
Expand All @@ -160,7 +160,7 @@ public class EmailAddress private constructor() {
*
* Here's an example of calling this function from Java code:
*
* SAMPLE: EmailAddressCompanionJavaSample.fromStringOrNull_Any_Any_Sample.md
* SAMPLE: EmailAddressCompanionJavaSample.fromStringOrNull_Any_Any.md
* </details>
*/
@JvmStatic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void fromStringOrNull_Any() {
System.out.println(address != null); // true
} // END

void fromStringOrNull_Any_Any_Sample() {
void fromStringOrNull_Any_Any() {
final Object value = "[email protected]";
final Object pattern = "^[a-z]+@[a-z]+\\.[a-z]+$";
final EmailAddress address =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ internal object EmailAddressCompanionKotlinSample {
} // END

@Suppress("FunctionName")
fun fromStringOrNull_Any_Any_Sample() {
fun fromStringOrNull_Any_Any() {
val value: Any = "[email protected]"
val pattern: Any = "^[a-z]+@[a-z]+\\.[a-z]+\$"
val address: EmailAddress? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ void fromStringOrNull_Any_should_pass() {
}

@Test
void fromStringOrNull_Any_Any_Sample_should_pass() {
void fromStringOrNull_Any_Any_should_pass() {
final EmailAddressCompanionJavaSample sample =
new EmailAddressCompanionJavaSample();
final String output = Assertions.assertDoesNotThrow(
() -> SystemLambda.tapSystemOut(
sample::fromStringOrNull_Any_Any_Sample
sample::fromStringOrNull_Any_Any
)
).trim();
final boolean actual = Boolean.parseBoolean(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class EmailAddressCompanionKotlinSampleTest {
}

@Test
fun `fromStringOrNull(Any, Any) sample should pass`() {
fun `fromStringOrNull(Any, Any) should pass`() {
val actual: Boolean = SystemLambda
.tapSystemOut(Sample::fromStringOrNull_Any_Any_Sample)
.tapSystemOut(Sample::fromStringOrNull_Any_Any)
.trim()
.toBooleanStrict()
assertTrue(actual)
Expand Down

0 comments on commit 96007a6

Please sign in to comment.