package ltd.hlaeja.test import java.util.UUID import org.assertj.core.api.AbstractAssert import org.assertj.core.api.AbstractStringAssert @Suppress("unused") fun ?> AbstractStringAssert.compareToFile( file: String, ): AbstractStringAssert = this::class.java.classLoader .getResourceAsStream(file) ?.bufferedReader() ?.readText() ?.let { this.isEqualTo(it) } ?: throw UnsupportedOperationException( "Attempted to compare assertion object to context of a file but expected file was not found: $file", ) @Suppress("unused") fun ?, ACTUAL> AbstractAssert.isEqualToUuid( uuid: String, ): SELF = try { UUID.fromString(uuid).let { expected -> this.isEqualTo(expected) } } catch (e: IllegalArgumentException) { throw UnsupportedOperationException("Invalid UUID string provided: $uuid", e) }