Skip to content

Conversation

@lucianbc
Copy link
Member

Convert a few easy files from java to kotlin

@lucianbc lucianbc requested a review from garanj July 3, 2025 14:28
internal object TestResultFormatter {
@JvmStatic
fun formatSuccess(successMessage: String): String {
return "[MEMORY_FOOTPRINT]: ✅PASS✅ $successMessage"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch adding the emoji for clarity! One small concern is that emojis might not render consistently across all environments (encoding, terminals, IDEs). To keep things universally compatible, maybe we could stick to plain ASCII symbols like !, or x instead.

String.format("Cannot extract User Configuration child from %s", node.nodeName)
)
}
for (i in 0 until node.childNodes.length) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might look cleaner to add an extension function like

fun NodeList.asList(): List<Node> =
    (0 until this.length).map { this.item(it) }

Then this part could be simplified to

return node.childNodes
    .asList()
    .firstOrNull { it.attributes?.getNamedItem("id")?.nodeValue == configValueId }
    ?.let { Optional.of(it) }
    ?: Optional.empty()

This would make the code a bit more concise and Kotlin-idiomatic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants