doc / ch.tutteli.atrium.api.fluent.en_GB / toHaveTheSameBinaryContentAs

toHaveTheSameBinaryContentAs

fun <T : Path> Expect<T>.toHaveTheSameBinaryContentAs(targetPath: Path): Expect<T> (source)

Expects that the subject of this expectation (a Path) has the same binary content as targetPath.

val notEmptyFilePath = tempDir.newFile("test_file_1")
notEmptyFilePath.writeBytes(byteArrayOf(1, 2, 3))

val expectedFilePath = tempDir.newFile("test_file_2")
expectedFilePath.writeBytes(byteArrayOf(1, 2, 3))

val emptyFilePath = tempDir.newFile("test_file_3")

expect(notEmptyFilePath).toHaveTheSameBinaryContentAs(expectedFilePath)

fails { // because nothing is written inside of `emptyFilePath`
    expect(emptyFilePath).toHaveTheSameBinaryContentAs(expectedFilePath)
}

Return
an Expect for the subject of this expectation.

Since
0.17.0